T O P I C R E V I E W |
rnnelson |
Posted - 10/14/2004 : 10:03:24 AM 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
|
3 L A T E S T R E P L I E S (Newest First) |
Mike Buess |
Posted - 10/20/2004 : 10:02:32 AM 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 |
rnnelson |
Posted - 10/20/2004 : 09:51:50 AM 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
|
Mike Buess |
Posted - 10/14/2004 : 11:21:35 AM 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 |