The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Dull question from an absolute beginner

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
oszkoa Posted - 01/08/2004 : 4:01:28 PM
I'm a novice in Origin scripting but now I should have to write a very simple program which would possibly make you smile. I began to read the help files on programming and try to type the examples in a script window (Origin 7 SR4, not Pro) but got stuck already at the beginning. I simply cannot find out how should I type opening and closing ['] and ["]. And even if I can repeat an example, there is a =-- string after the result.

Since the problem is so simple, I chose LabTalk instead of C/C++.

Thanks for your help: Oszkoa
5   L A T E S T    R E P L I E S    (Newest First)
oszkoa Posted - 01/11/2004 : 10:54:12 AM
Hi Mike,

Thank you for your answer, it made things clear. What confused me is that sometimes spaces mean something for Origin and sometimes they can be inserted or omitted without penalty.

Oszkoa
Mike Buess Posted - 01/10/2004 : 11:33:40 AM
Hi Oszkoa,

If there is no space between the variable letter and equal sign then Origin returns the value of the string variable...

%A = Data1_A;
%A=; // what is the string value of %A?
Data1_A

If you add the space then Origin substitutes the value of %A (which is Data1_A) and returns the value of the resulting expression...

%A =;
- is equivalent to -
Data1_A=;
- which, in turn, is equivalent to -
Data1_A[1]=; // what is the first element in dataset Data1_A?

When you ran your tests column A of Data1 was obviously empty.

%A =;
Data1_A=-- // missing value

If you enter 3.1416 in the first row of column A you'll get the following result...

%A =;
Data1_A=3.1416

I hope that made sense. It still confuses me at times.

...Note that the same thing happens when %A holds the name of a scalar variable.

%A=pi;
%A=;
pi

%A =;
pi=3.141593

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/10/2004 12:03:31 PM
oszkoa Posted - 01/10/2004 : 09:27:45 AM
I got it!

%A = Data1_A
%A = <enter> would give Data1_A =--

but omitting the space between %A and the = sign:

%A=<enter> would give simply Data1_A as it is expected.

This kind of behavior does not show up with numeric variables.

Oszkoa
oszkoa Posted - 01/09/2004 : 3:07:16 PM
Hello Greg,
Thank you for the answer. You are right, I was experimenting with string assignment. There is an example in the Substring Notation subsection of the String Variables section of Help/programming:

%A = “Results from Data2_Test” /* this is copied from the Help */
%A = "Results from Data2_Test" /* this is how I could type it in the Script window. This form did not work two days ago, that is why different ["] characters became suspicious. Pasting directly from the Help file into the Script window would replace the [“] and [”] characters with special Hungarian accented vowels.
The same were true for the
%B = %[%A, >‘_’] assignment.
Interestingly, both assignments worked nearly perfectly 15 minutes ago with the usual ["] and ['] characters. I say nearly, because I got the following results:
%A = [ENTER] gave Results from Data2_Test =--
%B = [ENTER] gave Test =--

Of course, the example you wrote worked perfectly.

Oszkoa
greg Posted - 01/09/2004 : 10:51:28 AM
Since you don't really say what you were doing, I can only guess.

Seeing =-- probably means you are trying to express a value in the Script Window. You would see something like this if you tried to express the value of an unassigned variable. For example:

value = <Press Enter>

would respond with:

VALUE =--

That '--' is Origin notation for Missing Value. If I assign this variable:

value = 13 <Press Enter>

then asked for the result:

value = <Press Enter>

I would see:

VALUE =13

Your mention of quotes makes me think what you want is to assign a STRING variable. In fact, you don't need either ' or " except in special circumstances. Cut and paste the following in the Script Window:

%M = This 'text' is a;
%N = "string; with semicolon";
%O = %M %N;
%M=;
%N=;
%O=;

Once pasted, select all the pasted text and press Enter. This is the output:

This 'text' is a
string; with semicolon
This 'text' is a string; with semicolon

The ' is treated as ordinary text and the " is needed in the second case to protect the ; character which LabTalk would see as end-of-statement.

In addition to the assignment section in the LabTalk Help file and Manual, you will find lots of examples of LabTalk that Origin uses in various OGS files in your Origin folder. You'll also find examples in the Knowledge Base section of this web site.


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000