Searching names of the waves in memory
phonon
So far, I've got a function that loads multiple data files, each with three columns of data, the names of which are the first element in the column. This seems to work just fine.
After loading all these files, the waves from each file are named something like this: AAA_XXX_1 ; BBB_XXX_1 ; CCC_XXX_1
The three waves from each file will all have the same XXX and ending number. In the end, I need to take two of these waves with the same XXX_1, fit them to a line, and output new waves with slopes and intercepts along with sigmas. But I don't think I'll have a problem with that once I can reference the proper waves by name.
For now, I'd really just like some help with calling the waves with the same XXX_1 from the "pile" of waves in memory.
I've tried using the WaveList command, but it never compiles correctly so I can't even see what the command does.
Any help will be greatly appreciated.
wave w = $stringname
Wavelist works great but you'd need to know what to filter for first. otherwise you will get a list of ALL waves in the current datafolder. Not really useful when you only want to fit 2 of them.
July 31, 2013 at 01:40 pm - Permalink
When you say "datafolder" do you mean the folder where the text files are stored or does it refer to the waves loaded into memory?
I realize now how I was misusing WaveList. It's not so much a command as it is a kind of reference. I was trying to use it as a direct command, but now I realize that I have to do something with it. Instead of:
WaveList ("*XYZ*",";","")
It has to be something like:
print WaveList ("*XYZ*",";","")
Now that I realize this, I think things will be easier.
July 31, 2013 at 01:55 pm - Permalink
Variable i
Variable nwaves = ItemsInList(listofwaves)
for (i = 0; i < nwaves; i += 1)
Wave w = $StringFromList(i, listofwaves)
< do something with w>
endfor
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 31, 2013 at 04:17 pm - Permalink
Run this code to see what I mean...
newdatafolder/o/s root:folder1
make wave1, wave2, wave3, apples
print wavelist("*", ";", "") //prints all waves in folder1
print wavelist("wave*", ";", "") //prints all waves starting with "wave" in folder1
setdatafolder root:
print wavelist("*", ";", "") //prints waves in root folder (none if this is run in a new experiment file)
newdatafolder/o/s root:folder2
make v1, v2, v3, j1, j2, j3
print wavelist("v*", ";", "") //print waves starting with v
print wavelist("j*", ";", "") //print waves starting with j
end
August 1, 2013 at 06:16 am - Permalink
Many thanks to you as well, proland.
August 1, 2013 at 01:24 pm - Permalink