Applying Protocols across multiple waves - how to define?

Hi

I'm trying to write a simple protocol to determine a threshold by measuring the maximum peak in a wave and then setting the value at a %age of that maximum. So far I have manage to do this rather simply through the use of the WaveStats()/Q command by setting a variable to correspond to V_max to achieve the calculation.
At the moment I can only get this to work by specifying the individual wave from which I want the threshold to be measured. Does anyone know how I would be able to apply this threshold measurement over multiple waves and get the protocol to report back the values as a list (the threshold listed for each wave) and then an average (a single number as an average of all the thresholds at the end)?
I hope this makes sense!

Thanks
You will need to use the Wavestats command on each wave, storing V_Max in either a wave or a string list. (your choice). Use a for loop for the number of waves you want to process. How you get the wavenames into the for loop is entirely up to you.

A listbox filled with wavenames could allow the user to select the ones they want.

OR

You could add all the waves you are interested in to a graph and use Tracenamelist to get the names of the traces on the graph.

OR

you could have the function you write accept a string and have the user enter the wavenames as a list when they call the function.


Each of these options has advantages and disadvantages in terms of functionality and user interface design. Of course, there are other options as well. If you are not familiar with writing code in Igor, you can find information by typing the following.

Displayhelptopic "User-Defined Functions"