
Calling waves from data browser in loop

geologic
This is a shortened version of a longer post.
Is there a way, if I have wave_1, wave_2, ..., wave_10 in the data broswer to loop in such a way that each iteration of the loop calls a different wave from the data browser?
Thanks!
If your wave names are really systematic like that, it is usual to use a loop to compute the names, without needing the Data Browser to do it. Something like this:
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
December 1, 2014 at 05:09 pm - Permalink
December 1, 2014 at 05:16 pm - Permalink
WaveList
function to get a list of all waves in the current data folder that fit criteria that you can specify.Then, extract items from the list one at a time using
StringFromList
in your loop. The "$" operator is needed to convert a list item to a wave reference.December 1, 2014 at 05:18 pm - Permalink
I like the generality of wavelist, so I'm using that for now. Plus, then I don't have to highlight waves in the data browser.
December 9, 2014 at 12:34 pm - Permalink
December 9, 2014 at 02:49 pm - Permalink
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
December 9, 2014 at 03:04 pm - Permalink
December 10, 2014 at 06:42 am - Permalink
string s1 = sample+"_"+stringfromlist(0,templist)
to put the name of an existing wave in string s1, then the wave must exist in the current data folder in order for
wave f = $s1
to give a valid wave reference.
December 10, 2014 at 07:38 am - Permalink
This $ business is starting to make sense...
December 10, 2014 at 12:00 pm - Permalink
I have a minimal working project that has achieved many of my objectives, so thank you to everyone who has helped.
any idea what my error is? i seem to be treating the continue test in the loop incorrectly. can the continue test not be written as a variable?
December 10, 2014 at 03:23 pm - Permalink
(corrected to account for Chozo's comment)
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
December 11, 2014 at 05:46 am - Permalink
i<=j
will count on element too much.itemsinlist
will give the number of elements (e.g., '4'), so you would have to count from 0 to 3 to loop through all elements. But since4<=j
is also true, the loop counts one more, and the reference fails since there are no more strings. The condition needs to bei<j
. This problem happens occasionally when one forgets that counting starts from zero.December 10, 2014 at 04:48 pm - Permalink
The code is all tuned up now!
December 11, 2014 at 08:05 am - Permalink
Probably the simplest way to get the list of all waves in the Data Browser is to use following macro:
Then one can refer to names, which are elements of nm wave.
February 6, 2020 at 08:17 am - Permalink