
Making Waves in for loops

igorman
This is the problem I've been stumped on:
Instead of having to use concatenate, I was wondering if there is any way I can make new "permanent" waves to save my results in. For example, how can I create a series of automatically named waves like (levels_0.1, levels_0.2), using the for loop, so that each time my loop is iterated, the results from FindLevels is copied into the series of appropriate waves. I would like that instead of saving the data to SelectiveCrossings and then using concatenate to override the overwriting in each iteration.
I'm sure it is something quite simple, and have been trying to look at example procedures but haven't been successful so far, any help would be greatly appreciated! I'm a beginner to Igor.
Make/O/N=0 AllCrossings for(i=0; i<numPoints; i+=1) yvalue = rawwave1[i] //This basically contains all my data points/trace FindLevels /D=SelectiveCrossings/EDGE=0/R=(0,29)/N=30/Q rawwave1, yvalue //This goes through each of the data point, and then basically finds out the places where that particular point is crossed through the series of data points. Concatenate /NP {SelectiveCrossings}, AllCrossings //In order to accommodate for overwriting my destination wave in each iteration of the for loop, I just used concatenate. It takes all the resulting data for each iteration //displaying them in one single wave, as a column/list. count0 += 1 endfor <pre><code class="language-igor">
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 26, 2013 at 01:17 pm - Permalink
June 26, 2013 at 01:27 pm - Permalink
June 26, 2013 at 01:42 pm - Permalink
I used the code snippet that you sent me and it works great. Thank you very much.
But now that I have divided the data accordingly, if I wanted to make a for loop where I can access each wave separately and run their elements through the same calculation, would I use something like LoadWave in my for loop?
Like this is the rough calculation I must try on each element of the Crossings0, Crossings1, Crossings2 waves:
June 26, 2013 at 02:14 pm - Permalink
I'm not J.J. but anyway ;-)
If the waves you want to access reside within the experiment (e.g. they are visible in the data browser) you don't need LoadWave. This is to load waves from disc into an experiment. You'll need to create a wave reference within your function. To read more about this, execute:
and for general reading I'd recommend the manual chapter IV-3 "User defined functions".
If you have a list of waves with common names and consecutive numbers you can use the following technique to access each of those waves individually:
June 27, 2013 at 02:55 am - Permalink
Thanks for the stand in my place. Your comments are always appreciated in the forum.
To igorman ... I offer the same recommendations as ChrLie made. You will do better to read the manual and try the programming examples it has. Otherwise, you will continue to build a bigger and bigger function with a cluttered array of small pieces that you only half understand, and you will later be fully confused when you inadvertently want to modify something in it.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 27, 2013 at 10:03 am - Permalink