name wave in procedure
mwpro
string xx = nameofwave(inputwave) + suffix
make $xx
wave yy = $xx
yy is the wave reference for the $xx wave, since $xx cannot be used in referencing ( or I am wrong). and I tested, in this way, the output wave will still be named
"xx", not "yy". It doesn't seem to be a good way, however, especially if I have a lot of input waves, and want to add a few suffixes to each (ie make a few waves out of each of the input waves), that means I have to use another set of wave references, like yy, too, which can be quite a few.
Or this could lead to another question. I want to execute the same function over multiple waves, like in
function xx (wave1, wave2, wave3 (,...))
each time, wave1, wave2 remain the same, but wave3 changes, and it will go through a list of waves. From my understanding, wavelist would return all waves in a datafolder, so I cannot put wave1, 2, 3 and others into the same datafolder because I don't want to include wave 1 and 2 in the list for wave3, but if I put the list of waves for wave3 in a subfolder and execute the function in a root folder, it will say wave does not exist.
Is there a good way to solve my problem?
Thank you!!!
1) internal wave references can be overwritten as often as you like if you want to work with another wave. No need to create a new wave reference for every wave. In for-loops this may look like this:
string xx = nameofwave(inputwave) + i
make $xx
wave yy = $xx
2) Yes,
wavelist
will give you a list of the waves in the current folder, but you can filter the names already when calling the function (take a look at the help for wavelist). Also if you happen to know the wave names you want to exclude, you can use stuff likeremovefromlist
to clean up the output afterwards.3) If you want to work with folders, you need to get into folder references and stuff. There is almost always a way to reference the correct waves in a folder. If you have a practical problem we can try to work through these things. Otherwise you may want to read the help about wave references including folders and, if you are confident, also about data folder referencing.
May 28, 2015 at 06:38 pm - Permalink
Thank you Chozo! I will try as you suggested and then come back! Thank you thank you!!
May 29, 2015 at 04:22 pm - Permalink