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
 Set Column Values + Before Formula Scripts

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
Steffen89 Posted - 02/04/2015 : 1:49:51 PM
Origin Ver. and Service Release (Select Help-->About Origin): 9.0 and 9.1
Operating System: Win7

Hi @ all
I am a beginner in programming with Labtalk. My Problem is to use an if/else Statement in "set Column Values". For Example I have Col(B) with 10 Values from 1 to 10. If the value is smaller than 5 (e.g. 4 3 2 1), I want to calculate Col(B)*Col(B).
If the Value is greater than 5, I want to calculate Col(B)*sqrt(Col(B)+1).
Formula: Col(C)= Col(B)*dN
I wrote the script in that way:
if Col(B) < 5
{
 dN = Col(B);
}
else
{
 dN = sqrt(Col(B)+1);
}

Can Someone explain, what I forgot in this code, please? Maybe the declaration of dN?

Thanks for Helping
1   L A T E S T    R E P L I E S    (Newest First)
lkb0221 Posted - 02/04/2015 : 5:35:39 PM
You can directly write the following syntax in the function body, no before script needed:
col(B)<5? col(B)*col(B):col(B)*sqrt(Col(B)+1)

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