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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 IF/ELSE in "Set Column Values"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rnnelson

USA
3 Posts

Posted - 10/14/2004 :  10:03:24 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 Pro SR4
Operating System: Windows 2000 Pro
I have an application in which I need to set column values to 1 of 4 different equations based on the value of the variable in the x-column. Doing this with nested IF type statements is extremely awkward. Is there an "IF/ELSE" type function available in the set column values. I know there is an IF/ELSE structure in labtalk but I would rather not have to write and execute a separate Labtalk function.
Bob

Mike Buess

USA
3037 Posts

Posted - 10/14/2004 :  11:21:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Bob,

Depending on your equations you might be able to use ternary operators in place of IF/ELSE statements. See the following forum topic for an example...

http://www.originlab.com/forum/topic.asp?TOPIC_ID=3285

Mike Buess
Origin WebRing Member
Go to Top of Page

rnnelson

USA
3 Posts

Posted - 10/20/2004 :  09:51:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Mike,
I figured out a way to do this as follows:
For each segment create the appropriate test and follow it with the statement to be executed.
Then (on a separate line for clarity) add a colon.
Repeat this for all but the last step which simply has the equivalent of the "else" following the last colon. See the example below. Because the tests are in order, there is no need to use multiple tests at each step. The procedure executes until a logical test is satisfied or until the final step is reached.
Bob

col(T)> 90.3 ? 8.06158 - 917.20884/col(T)+ 0.0305
:
col(T)> 89.3? 9.4576 - 1044.0/col(T) + 0.0305
:
col(T)> 87.3? 6.962 - 820.84/col(T)+ 0.0305
:
166.64523 - 3398.39776/col(T) - 67.07301*log(col(T))+ 0.0305

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/20/2004 :  10:02:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Bob,

Cool! I didn't know that was possible. I think that deserves a spot in OriginLab's Knowledge Base. Perhaps even in the manual. Could be very useful for those who rely on Set Column Values.

Mike Buess
Origin WebRing Member
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000