T O P I C R E V I E W |
eathiele |
Posted - 09/11/2012 : 4:59:03 PM Origin Ver. and Service Release: 8.5.1 SR2 Operating System: Win7
This is what I have: Col(A) = an array of string values serving as IDs for each row. Col(B) = measure of variation
This is what I want: If (Col(B)>cutoff value), then copy corresponding value in Col(A) to Col(C), else leave blank (or --).
How do I do this? Ternary [i.e., Col(B)>cutoff value?Col(A):] does not work with string values in Col(A). Nor does treplace.
If I set Col(A) as a StringArray (sa) and do
if (Col(B)>cutoff value) sa.CopyTo(Col(C))
it will copy all of Col(A) to Col(C), apparently ignoring the conditional statement.
What am I missing? Though I have virtually no coding experience, it seems like it should be very simple to selectively copy an element from a String Array based on a condition or set of conditions.
Thanks! |
2 L A T E S T R E P L I E S (Newest First) |
eathiele |
Posted - 09/12/2012 : 3:45:13 PM So far, so good!
Thank you so much, Hideo!! |
Hideo Fujii |
Posted - 09/11/2012 : 6:32:32 PM Hi eathiele,
I believe, but I may be wrong, the conditional operator works as a numeric operator. So, you wouldn't be able to achieve in this venue. So, if you use a loop, may be like as follows:
loop(ii,1,wks.maxRows) {if(col(B)[ii]>0.5) col(C)[ii]$=col(A)[ii]$; else col(C)[ii]=1/0;}
Maybe someone can give a better answer.
--Hideo Fujii OriginLab |
|
|