Duplicating recurring rows

Hey folks,

I'm new to the forum, but I will likely become a fixture here. Igor is a new program for me, but my line of grad work requires its use daily. Thanks for fielding my question!

I'm trying to duplicate specific rows from an existing wave into a new wave. For example, say I have 200 rows of data in 4 waves. I would like to put every tenth value from wave1 into a new wave....

How do I go about that?

Thanks!

so far, I've found this in the manual. however, it's still unclear how to choose every tenth value...

wave1[1,*;2] = 100 // sets every odd point of wave0
extract originalWave,resultWave,mod(p,10)==0 will probably do what you want.

A
Hmm, I think this will do the job, too:
To extract every tenth value make a wave which has n/10 rows (20 in your case):

make/n=20 newwave

Then use the row counter 'p' in the expression (will count through all rows of newwave, i.e. 0....19):

newwave = wave1[10*(p+1)] // extract point 10, 20, 30, 40, ...
chozo wrote:
newwave = wave1[10*(p+1)] // extract point 10, 20, 30, 40, ...


Of course this works as well as my approach. Just be carefull with indexing on the right side of the equation. Your example doesn't extract a value from the first 10 points of wave1 and in return two values from the last 10 points of wave1. Used in a user-defined function compiled with #pragma rtGlobals=3, it would actually throw an error, because the index runs to 200.
Use newwave = wave1[10*p+j] where j is the first point that gets extracted and should be from the interval [0,9]. So choose j=0 (or omit j) if you want to extract points 0, 10, 20, 30, ..., or j=1 to extract the points 1, 11, 21, 31, ..., etc.

A