change text following the wave symbol in the legend's annotation
vishivishi
Function legend_change()
Variable index = 0
String list = WaveList("*", ";", "")
Variable numItems=ItemsInList(list)
String theWave
for (index=0;index <numItems;index+=1)
theWave = StringFromList(index, list)
Display /W=(610,132,1501,633) $theWave[*][1],$theWave[*][2]
Legend/C/N=text0/F=0/A=MC/X=40.25/Y=32.33
Legend/C/N=text0/J "\\s(theWave#1) new_name_for_wave1 \r\\s(theWave#2) new_name_for_wave2"
endfor
End
Variable index = 0
String list = WaveList("*", ";", "")
Variable numItems=ItemsInList(list)
String theWave
for (index=0;index <numItems;index+=1)
theWave = StringFromList(index, list)
Display /W=(610,132,1501,633) $theWave[*][1],$theWave[*][2]
Legend/C/N=text0/F=0/A=MC/X=40.25/Y=32.33
Legend/C/N=text0/J "\\s(theWave#1) new_name_for_wave1 \r\\s(theWave#2) new_name_for_wave2"
endfor
End
I get the same ?? when instead of
Legend/C/N=text0/J "\\s(theWave#1) new_name_for_wave1 \r\\s(theWave#2) new_name_for_wave2"
I used
Wave/Z w = WaveRefIndexed("", index, 4)
I figured it's something to do with string escape calling a wave from the legend but could not find a way to make it work.
Thanks!
Variable index = 0
String list = WaveList("*", ";", "")
Variable numItems=ItemsInList(list)
String theWave
for (index=0;index <numItems;index+=1)
theWave = StringFromList(index, list)
Display /W=(610,132,1501,633) $theWave[*][1],$theWave[*][2]
// Start of changed lines
String legendTextForTrace1 = "Hello"
String legendTextForTrace2 = "Goodbye"
String format = "\\s(%s#1) %s\r\\s(%s#2) %s"
String text
sprintf text, format, theWave, legendTextForTrace1, theWave, legendTextForTrace2
Print text // For debugging only
Legend/C/N=legend0/F=0/A=MC/X=40.25/Y=32.33 text
// End of changed lines
endfor
End
December 29, 2011 at 02:01 pm - Permalink
Ooops, sorry! Yes, it does work. Thanks!
December 29, 2011 at 02:24 pm - Permalink