I have written a function to get values from the top window and put them in the command line. But now I wanted to have this function keep track of values in a table for all open windows when the windows are not named in order. Is there a way for Igor to work on traces contained within all opened windows? And how may I keep track of the V_LevelX for each trace in a table? I am having difficulty getting this variable stored in any way except printing it.
Thanks in advance.
Function d()String wnames =wavelist("*",";","WIN:")//WIN: means top graphString name
Variableiwave a
for(i =0;i<itemsinlist(wnames);i +=1)
name = stringfromlist(i,wnames)print name
printrightx($name)FindLevel/Edge=2/Q/R =(2,10)$name ,-0.4; print V_LevelX;
FindLevel/Edge=2/Q/R =(15,30)$name ,-0.4; print V_LevelX;
FindLevel/Edge=2/Q/R =(31,50)$name ,-0.4; print V_LevelX;
endforEnd
The wavelist command can work on windows other than the top window by using the windowName.
"WIN:windowName" Consider all waves in the current data folder that are displayed in the named table or graph window or sub window.
To get the list of windowNames, you can use the WinList command with the specifier
"WIN:windowTypes " Consider windows that match windowTypes and graphs are type 1.
You can incorporate Andy's suggestion by enclosing your loop in a loop that goes through the windows, or you can add an argument to you function that takes the window name and then write a separate function that passes window names to your original function.
Instead of printing: a good solution is to make a textwave for your tracenames and then a numeric wave for the values, since you are pulling several values out this should be a 2D wave. Something like:
Function d()String wnames =wavelist("*",";","WIN:")//WIN: means top graphString name
Variablei//wave a //don't need thisVariable nWaves = itemsinlist(wnames)Make/O/T/N=(nWaves) labelWave
Make/O/T/N=(nWaves,4) resultWave
for(i =0;i< nWaves;i +=1)
name = stringfromlist(i,wnames)Wave w0 = $name
labelWave[i] = name
resultWave[i][0] = rightx(w0)FindLevel/Edge=2/Q/R =(2,10) w0 ,-0.4
resultWave[i][1] = V_LevelX
FindLevel/Edge=2/Q/R =(15,30) w0 ,-0.4
resultWave[i][2] = V_LevelX
FindLevel/Edge=2/Q/R =(31,50) w0 ,-0.4
resultWave[i][3] = V_LevelX
endforEdit labelWave,resultWave // show in a tableEnd
Warning: I've not tested that!
This will give your four values in each column, where each row is a wave in your window.
If you incorporate Andy's suggestion, you'll need to come up with a naming system for the labelWave and resultWave otherwise you'll just end up with the values for the last window the function processes.
The wavelist command can work on windows other than the top window by using the windowName.
"WIN:windowName" Consider all waves in the current data folder that are displayed in the named table or graph window or sub window.
To get the list of windowNames, you can use the WinList command with the specifier
"WIN:windowTypes " Consider windows that match windowTypes and graphs are type 1.
Andy
September 20, 2016 at 01:16 pm - Permalink
You can incorporate Andy's suggestion by enclosing your loop in a loop that goes through the windows, or you can add an argument to you function that takes the window name and then write a separate function that passes window names to your original function.
Instead of printing: a good solution is to make a textwave for your tracenames and then a numeric wave for the values, since you are pulling several values out this should be a 2D wave. Something like:
Warning: I've not tested that!
This will give your four values in each column, where each row is a wave in your window.
If you incorporate Andy's suggestion, you'll need to come up with a naming system for the labelWave and resultWave otherwise you'll just end up with the values for the last window the function processes.
Hope that helps
September 20, 2016 at 01:46 pm - Permalink
September 20, 2016 at 02:55 pm - Permalink