![](/profiles/wavemetrics/themes/wavemetrics/logo.png)
NewDirectory issue
![](/sites/default/files/styles/thumbnail/public/default_images/Artboard%201_1.png?itok=jeHOCIXy)
Hi forum,
My question contains 2 parts,
In my procedure, I am extracting data from waveP1x0 and waveP2x0 and doing some wave analysis. At one stage I need to move waves from folder "rec1" to "tests" such that for each pair (such as NearbyR0x and Nearby R0y) i want to create a folder that contains each point. When I run my code all the previous folders are also created in destination folder "tests" (the one that are highlighted in yellow), and the name strings "NearbyR"+num2str(b)+"x(or y)" are not moved the each corresponding folder. I also get this error (while executing MoveWave, the following error occurred: expected wave name).
Here is the last piece of my code
string recon = "recon"+num2str(b)+"rxy" string recon_col0 = "R"+num2str(b)+"recon" string recon_col1 = "NearbyR"+num2str(b)+"x" string recon_col2 = "NearbyR"+num2str(b)+"y" //these create each waves wave rec0=$recon_col0, rec1=$recon_col1, rec2=$recon_col2 rec0=beson[p][0] rec1=beson[p][1] rec2=beson[p][2] NewDataFolder /o IndividualPoints duplicate $wnamex, root:tryFolders:IndividualPoints:$wnamex duplicate $wnamey, root:tryFolders:IndividualPoints:$wnamey NewDataFolder /o R_waves NewDataFolder /o R_xy_to_all_other duplicate $Ar, root:tryFolders:R_waves:$Ar duplicate $rPx, root:tryFolders:R_xy_to_all_other:$rPx duplicate $rPy, root:tryFolders:R_xy_to_all_other:$rPy NewDataFolder /o Concatinated duplicate $bol, root:tryFolders:Concatinated:$bol NewDataFolder /o Sorted_R_waves_between7and12 duplicate $dataR, root:tryFolders:Sorted_R_waves_between7and12:$dataR NewDataFolder /o rec0 NewDataFolder /o rec1 NewDataFolder /o rec2 duplicate $recon_col0, root:tryFolders:rec0:$recon_col0 duplicate $recon_col1, root:tryFolders:rec1:$recon_col1 duplicate $recon_col2, root:tryFolders:rec1:$recon_col2 //moved all in one folder killwaves /A/Z //to kill all other waves in "tryFolders" folder newdatafolder /o root:tryFolders:rec1:tests SetDataFolder root:tryFolders:rec1:tests string WaveNear = "NearbyR"+num2str(b)+"xy" //set string variable name for folders b is defined from 0 to 54 NewDataFolder root:tryFolders:rec1:tests:$WaveNear MoveWave $recon_col1, root:tryFolders:rec1:tests:$WaveNear MoveWave $recon_col2, root:tryFolders:rec1:tests:$WaveNear // Part 2:ATTEMPT TO: Use for loop for $WaveNear folders (this part has not been tested yet) SetDataFolder root:tryFolders:rec1:tests:$WaveNear //not sure about $ , I here trying to start my loop within each folder For (c=0; c < numpnts($WaveNear); c+=1) string wNx = "p"+num2str(b)+"x" duplicate/o $WaveNear, $wNameX wave wvNxx =$wNx wvNxx= $WaveNear[b] string wNy = "p"+num2str(b)+"y" duplicate/o wwNyy, $wNy wave wvNyy =$wNy wvNxx= $WaveNear[b] //here to do some operation***** Endfor
Second Part:
I once have each wave in corresponding folder, I then want to do a For loop for each folder (string WaveNear = "NearbyR"+num2str(b)+"xy" ) and do some analysis on each wave in different folder. Since I already have a for loop, can I use another for loop with "c" being a variable for number of wave points in each folder "WaveNear"? I tried to run a for loop within a for loop , it either gave me error took very long time to load and igor crashed.
thanks for your Help
![what is outputed](/sites/default/files/styles/content_body/public/2019-09/Folders.png?itok=wjy4BcLs)
A few thoughts are immediately apparent to me to troubleshoot and/or improve your processing on Step 1:
September 9, 2019 at 06:51 pm - Permalink
In reply to A few thoughts are… by jjweimer
Having gone through your comments, I figured how to move the waves to corresponding folders here:
Now I am working to figure out the second part
Thanks,
September 10, 2019 at 10:30 am - Permalink
Is this what you are trying to accomplish?
September 10, 2019 at 12:54 pm - Permalink
In reply to Is this what you are trying… by jjweimer
I was able to solve Part 1 of my question, which is moving waves from folder "tests" to each corresponding folder (WaveNear). So no issue about that.
Now that I have 2 waves in each folder; Part 2 of my question is, that I am trying to do a loop for each data folder:
I am using Do/While to go over the number of corresponding folders in main folder "tests", and I use a For Loop for waves in each corresponding folders,
My code does work but only for last folder, "NearbyR54xy". Other folders (such as NearbyR54xy) are empty and have and have no points. (as seen in image attached)
Here is the snippet
Also as you see in code rPxWave1, rPxWave2 and Rwaves1 supposed to give waves with names rr..xToAll, rr..yToAll and RR respectively. I don't know why those waves are not created
September 10, 2019 at 02:00 pm - Permalink
Where do you update $WaveNear in the do-while loop? Otherwise, the loop stays in one data folder.
You probably should avoid "e" as a counter in a loop.
I must admit that the approach being taken remains too convoluted with naming and duplicating processes for me to follow it easily.
Also, I have to think that some of the processing may be better handled by implicit loops over wave points.
I don't know at this point what else to suggest.
September 10, 2019 at 02:27 pm - Permalink