Referencing ALL waves within the Data folder?
Sandbo
http://www.igorexchange.com/node/7892
Instead of creating a 2D wave, I can also afford to create a bunch of 1D wave with dynamical wave naming.
That is, I can create instead of a 2D Data wave as (100,10), but ten Data waves as Data1, Data2, ... , Data10, where each one is 100 pnts.
But then there is another problem,
if I use a sub-routine to create these waves, is there a way to "dynamically" reference to them?
That is, I want to use the command
string waveName1
for (i=1; i<=10; i=i+1)
waveName1 = "Data"+num2str(i)
wave $waveName1 //<--not allowed
endfor
But it won't work as the LHS does not accept indices.
The only possible way I could think of is just reference all existing (previously created waves) once, or
just put the wave creating routines inside this main routines, so the
make
command will already reference them. I wanted to avoid this as I would like the subroutine to be available for other functions.Thanks for reading, any suggestions are appreciated.
wave DataIO = $waveName1
Capture(DataIO)
...//Repeat for all other instances of Capture()
may not be the smartest way, but I think I will go for it now.
August 28, 2017 at 03:35 pm - Permalink
DFREF Folder
// Counts the number of waves in the folder
Variable n=CountObjectsDFR(Folder, 1)
// Creates a list of all waves in the folder
Make/FREE/O/WAVE/N=(n) AllWaves=WaveRefIndexedDFR(Folder, p)
Return AllWaves
end
August 29, 2017 at 03:12 am - Permalink
DFREF Folder
string wl= waveList("*",";","") // get a string list of all waves
make /FREE/O/WAVE/N=(itemsInList(wl)) allWaves= $stringFromList(p, wl)
Return AllWaves
end
It's definitely not better since it goes through the string format, but more useful in macros.
September 18, 2017 at 12:48 pm - Permalink