Rename Graphwindow from string variable

 

Dear Igor users,

Today I am having some trouble with naming the graph-windows. I would like to be able to give the graph (or window, does it matter?) a name that is stored in a string variable. However, what happens is that the graphwindow gets the literal of that I write after the /N flag (in the code 'graphName' will be the new title). I tried to workaround this with the RenamWindow command, but got the same trouble. See code below.

Is there a way to name the graphs in the way that I want to do?
 

Function displayGraph(this_wave, x_axis, graphName)
String this_wave
String x_axis
String graphName
Display /N=graphName /L=VertCrossing/B=HorizCrossing $this_wave vs $x_axis;
end
Display/N=$graphName

Beware that the actual name may differ. Check the value of S_Name.

You can always use DoWindow/C $graphName to ensure you get the name you expect.

Software Engineer, WaveMetrics, Inc.