Hi, I was trying to categorize my measurement data waves by a text wave, is this done by an If-statement? Or there are other better methods? If by "If', how could I program a conditional statement that will give either true or false based on the text content of that data point in the text wave? Thank you!!
I'm not sure what you are asking but this may give you some ideas:
Function Test(tw)
Wave/T tw
Variable numPoints = numpnts(tw)
Variable i
for(i=0; i<numPoints; i+=1)
String str = tw[i]
if (CmpStr(str,"Green") == 0)
Printf "Point %d is green\r", i
endif
endfor
End
Function Demo()
Make/O/T textWave = {"Red", "Green", "Blue"}
Test(textWave)
End
hrodstein wrote: I'm not sure what you are asking but this may give you some ideas:
Function Test(tw)
Wave/T tw
Variable numPoints = numpnts(tw)
Variable i
for(i=0; i<numPoints; i+=1)
String str = tw[i]
if (CmpStr(str,"Green") == 0)
Printf "Point %d is green\r", i
endif
endfor
End
Function Demo()
Make/O/T textWave = {"Red", "Green", "Blue"}
Test(textWave)
End
Thank you hrodstein! This is exactly what I am looking for!!
May 8, 2015 at 09:23 pm - Permalink
Thank you hrodstein! This is exactly what I am looking for!!
May 11, 2015 at 10:32 am - Permalink