
Extracting text wave values to use in duplicate

ssmith911
I'm trying to assign a text wave value to a string variable, it doesn't compile.
I'm missing something obvious I'm sure but need some help seeing it. Can someone explain what I'm doing wrong. Thanks.
Function CopyWaves() Wave Listofwaves //IS a wave where each element is the name of a wave in the "root:rawdata" folder String localwavename Variable z NEWDATAFOLDER/O root:working FOR(z=0;z<(numpnts(ListofWaves));z+=1) localwavename = ListofWaves[z] Duplicate/O root:Rawdata:localwavename, root:working:localwavename ENDFOR END
December 23, 2021 at 10:24 am - Permalink
You need the /T flag when a text wave is declared.
December 23, 2021 at 10:24 am - Permalink
You need to tell the complier that 'Listofwaves' is a text wave i.e.
Wave /T Listofwaves
You might also need to chose a different letter than 'z' as your iterating variable as it has special meaning i.e. chunk index of a wave.
December 23, 2021 at 10:27 am - Permalink
Thank you all very much. The "/T" in the declaration and the "$" in front of "localwavename was the ticket. Thanks. Also good point about using z as a variable. Merry Christmas and a happy new year to everyone. Thanks again
ssmith
December 23, 2021 at 12:43 pm - Permalink