![](/profiles/wavemetrics/themes/wavemetrics/logo.png)
Converting waves into multiple waves
![](/sites/default/files/styles/thumbnail/public/default_images/Artboard%201_1.png?itok=jeHOCIXy)
ahmed.shaaban86
Good morning the amazing Igor community,
I have a simple wave created within a macro that has 3 points. I would like to write a line where I can kind of "transpose" those three points and make each of them a point where I can call it something like "treatment A", "treatment B", "treatment C"
do you have any ideas how to do that?
Thank you very much in advance and attached you can see the picture of a created wave
All the best
Hi,
If I understand correctly, you'd like three waves each with one point?
August 26, 2022 at 01:33 am - Permalink
In reply to Hi, If I understand… by sjr51
Thank you very much!! That is exactly what I want. The script runs well until the line:
SplitWave/NAME=("treatmentA;treatmentB;treatmentC") myWave
It tells me "name already exists as a wave" and it is referring to "myWave" at the end of this line, any ideas what to change?
August 26, 2022 at 02:07 am - Permalink
I have added the overwrting option and I went through the error. Now I have another problem of not being able to change the name of the columns (kindly see the attached picture)
Please not that to create such a wave, I have $ during creation of the wave. I have also included the full macro that I am using. In this case the $IR produced wave is the one I want to transpose and relabel it
August 26, 2022 at 03:11 am - Permalink
First, I missed a terminating semicolon in my example, it should have said:
SplitWave/NAME=("treatmentA;treatmentB;treatmentC;")/O myWave
And yes, overwriting is good, but as you have discovered the names are fixed so that they will continually overwrite themselves in your do-while loop. So what you need to do is construct a string of semicolon separated names in each iteration. Like you do for the IR string variable. Here's one way:
August 26, 2022 at 04:08 am - Permalink
In reply to First, I missed a… by sjr51
Dear sjr51,
Fantastic!! Thank you very much for the great help. That just leaves me with one thing; I get the IRP, RRP, and RRPtotal in three seperate waves and not in a single one with multiple columns. Is that how I should do it? or is there a way where I can fuse the three in the same wave as I was intending ?
Many Many thanks!!
August 26, 2022 at 04:14 am - Permalink
Perhaps sjr51 misinterpreted what you are trying to do. It seems to me that you want to end up with 1 wave that has 1 row and 3 columns, and each column has the dimension label set. If that's what you want, it's pretty easy to do. Note, however, that there may be no reason to make the wave 1 row by 3 columns. You could also make the wave a 1D wave with 3 rows.
Here is an example function. I recommend that you run one line at a time on the command line so you can see what is happening.
As a note, if you knew from the beginning that you wanted to create a 2D wave with 1 row and 3 columns, your make statement would be:
Make/O/N=(1,3)/D wave1
August 26, 2022 at 06:50 am - Permalink
Hello,
It's not clear what form you want the final three values to be in. Do you want them in a wave where you can refer to them by some name ("IRP, RRP, RRPtotal")? In that case look into row (or column) labels. Type this in the command line.
displayhelptopic "SetDimLabel"
Or the values could be saved as variables (globals if you need them to persist when your function execution ends):
August 26, 2022 at 06:50 am - Permalink