making three waves from every 3 elements of a wave?
Amo
Hello Forum,
This question is simple, but I'm new to igor. I have a wave0 which has some data points and i want to make three new waves (wave1, wave2, wave3) that have elements of wave0 such that wave1 has elements 0th, 3rd , 6th .... and so on; wave 2 has elements 1st,4th,7th ... and so on; wave 3 has elements 2nd, 5th, 8th... and so on. In other words create three waves that have every three elements of wave0 in order.
I learned how to make two waves that has 2 points of wave0 , by using odds and even simple code
make /n=100 wave0=x
make /n=(numpnts(wave0)/2) wave1
make /n=(numpnts(wave0)/2) wave2
wave1[]=wave0[2*p]
wave2[]=wave0[2*p+1]
make /n=(numpnts(wave0)/2) wave1
make /n=(numpnts(wave0)/2) wave2
wave1[]=wave0[2*p]
wave2[]=wave0[2*p+1]
is there a similar simple code to make it for every three elements or should I make a loop ?
Your help is appreciated.
you mean like this?
make /n=(numpnts(wave0)/3) wave1
make /n=(numpnts(wave0)/3) wave2
make /n=(numpnts(wave0)/3) wave3
wave1[]=wave0[3*p]
wave2[]=wave0[3*p+1]
wave2[]=wave0[3*p+2]
March 22, 2019 at 02:52 pm - Permalink
In reply to you mean like this? make … by tony
Yes!!! thank you. I thought I need to do iteration, but i see now with igor things are simpler than I thought. :)))))
March 22, 2019 at 03:19 pm - Permalink
I can't help offering a tricky solution :)
•Redimension/N=(3,1000) junk
•matrixTranspose junk
•Splitwave junk
Note that this technique requires that the wave (junk, in this case) have a number of rows that is divisible by three.
March 22, 2019 at 04:40 pm - Permalink