Author |
Topic  |
|
abhishek.khare
United Arab Emirates
9 Posts |
Posted - 05/29/2023 : 08:33:50 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): Operating System: OriginPro 2021b (64-bit) SR1 9.8.5.204
Hello there,
I have a small problem of making conditional statement and execute few lines of code. Following is the code in which I am check values of Col(5) and Col(9) and if they have specific values then setting Col(10) value. But the code does not produce intended output. At the end I should have few 100 and few 200 in Col(9) but I get only 200. Can anyone advice whats wrong here? I would appreciate. Thanks.
//Get the ranges of the required columns range ra = [mybk$]acaoasheet$!col(2); range rf = [mybk$]acaoasheet$!col(5); range rl = [mybk$]acaoasheet$!col(9); range r10 = [mybk$]acaoasheet$!col(10); //Initialize col10 with rf r10 = rf; //update the r10 values as per logic below if ((rf==0) && (rl=="UP")) { //r10 = 0.6206*ra+0.4007; r10 = 100; } if ((rf==0) && (rl=="DN")) { //r10 = 1*ra; r10 = 200; } |
|
cpyang
USA
1406 Posts |
Posted - 05/29/2023 : 12:40:04 PM
|
You code show you are just doing column calculations, so why not use column formula?
You are trying to do things in LabTalk code that is much simpler if using formula. For the starter, Labtalk code does not have column (vector) level comparison, like your rf==0, but colume formula dose support such notation.
CP
|
 |
|
abhishek.khare
United Arab Emirates
9 Posts |
Posted - 05/31/2023 : 03:38:40 AM
|
Thanks cpyang, much appreciated!
quote: Originally posted by cpyang
You code show you are just doing column calculations, so why not use column formula?
You are trying to do things in LabTalk code that is much simpler if using formula. For the starter, Labtalk code does not have column (vector) level comparison, like your rf==0, but colume formula dose support such notation.
CP
|
 |
|
|
Topic  |
|
|
|