Make graph with WaveName

Hy !

I've a lot of data to import in a graph (~300 waves) and I don't know how to make a macro able to plot a wave vs an other just using their name.

I have a folder with X vawes : 'E_1_xxx' 'E_2_yyy' 'E_3_zzz' and an other for Y waves 'S_1_xxx' 'S_2_yyy' 'S_3_zzz' (I can merge both if necessary of course) , where xxx yyy zzz are strings containing wave's informations (same strings for same 'E' and 'S' waves number).

Is that possible to make a macro to plot 'S_1_xxx' vs 'E_1_xxx' until the total number of wave?

I am not asking for a complete code (unless you have it :) ) but just for advises and ideas !

Thanks !





This is absolutely possible.

1. set datafolder to the x folder. Use WaveList to get a string list of all the waves in the X folder
2. repeat step 1 for the y folder. You now have 2 strings which contain all the wave names you need.

string xnames
string ynames
variable i

for (i=0; i<itemsinlist(xnames); i+=1)
display $(stringfromlist(i; ynames; ";")) vs $(stringfromlist(i; xnames; ";"))
endfor


this will make 1 graph for each xy pair. Since the two lists will be sorted in the same manner, the X and Y names should be in the correct order.
Proland didn't emphasize this, but what you need to use (as used in his example) is the "$" operator. For more information, you can execute the following command in Igor's command line:
DisplayHelpTopic "Converting a String into a Reference Using $"
Thks again for your precious help !!!!!!

Here is the final code :

Menu "Macros"
    "FEES.../1", GraphE_S() //Ctrl+1
End
 
Macro GraphE_S()
    GraphES()
End


Function GraphES()
   
    string xnames = WaveList("E*",";","")
    string ynames = WaveList("S*",";","")
    variable i
   
    display $(stringfromlist(0, ynames, ";")) vs $(stringfromlist(0, xnames, ";"))
 
    for (i=1; i<itemsinlist(xnames); i+=1)
        AppendToGraph $(stringfromlist(i, ynames, ";")) vs $(stringfromlist(i, xnames, ";"))
    endfor
   
end


I've finally merged my two data folders, it's easier to call xnames and ynames and I display all the waves on the same graph.

In this case, all waves have the same color, so I use this code (which can be useful for someone else !) :

Menu "Macros"
    "Color waves.../2", ColorWaves() //Ctrl+2
End
 
Macro ColorWaves()
    Variable rev = 1
    String colorTable = "dbZ14" // Choose the colorTable you prefer in Igor !
    ColorTraces(rev, colorTable)
End
 
Function ColorTraces(rev, colorTable)

    Variable rev
    String colorTable
 
    String list = TraceNameList( "", ";", 1 )
    Variable numItems = ItemsInList( list )
    if ( numItems == 0 )
        return 0
    endif
 
    ColorTab2Wave $colorTable
    Wave M_colors  
 
    Variable index, traceindex, step
    step =0;
    for( index = 0; index < numItems; index += 1 )
        if (step/DimSize( M_Colors, 0 ) == 1)
            step=0;
        endif
       
        Variable row = step     //( index/numItems )*DimSize( M_Colors, 0) if you prefer a gradient
        traceindex = ( rev == 0 ? index : numItems - index )
        Variable red = M_Colors[ row ][ 0 ], green = M_Colors[ row ][ 1 ], blue = M_Colors[ row ][ 2 ]
        ModifyGraph/Z rgb[ traceindex ] = ( red, green, blue )
       
        step+=1
    endfor
 
    KillWaves/Z M_colors
End
I use the colortraces function quite often. However, as one of my colleagues likes to load all of his data on 1 or 2 graphs and hide most of it, I only have mine act on visible traces. This also lets me, say hide fit waves, re-color the visible traces, and then make the fit waves visible again (saves a little time in some instances).