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
 Origin Forum
 Using variables

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
RockerSWE Posted - 03/31/2010 : 03:05:39 AM
Hello,

When running the import wizard (from asci data files), I set the header and variables to be extracted from the header. This works fine.

I would then like to run a script which takes the variable value, and multiplies it with a column and puts the result in a new column. For example, if the variable is named "T", I tried:
wcol(4)=T*wcol(3)
This does not work. Is it possible to do this using scripting only?

Origin Ver. and Service Release (Select Help-->About Origin): 8.0
Operating System: Win Vista

4   L A T E S T    R E P L I E S    (Newest First)
RockerSWE Posted - 03/31/2010 : 07:28:15 AM
That worked! Thanks for your help.
larry_lan Posted - 03/31/2010 : 05:48:32 AM
The variables you extract from header are saved as string, and you cannot use them directly by their name. You can open Workbook Organizer to see how to access the variables by tree. It should looks like page.info.user.variables.varName$. Supposed there is a variable named TT, you can change the script into:

// Extract the variable, and convert into double
double tt = %(page.info.user.variables.TT$);
ty "TT is $(tt)";
wcol(3) = tt*wcol(2);


Hope this helps.

Larry
OriginLab Technical Services
RockerSWE Posted - 03/31/2010 : 05:00:14 AM
I get the following message:
"The value of TT is --."

(It should be 400)
larry_lan Posted - 03/31/2010 : 04:55:11 AM
Maybe is the scope of the variable? And you should avoid use the variable name T, maybe TT instead.

try:

ty "The value of TT is $(TT)."
wcol(4)=TT*wcol(3);


To see if TT is valid.

Larry

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