Renaming waves when duplicating graph

Is there a way that I have missed to rename all waves in a graph semi-automatically by appending a suffix for example? Currently I am renaming them one by one manually but this is proving tiresome. So if I have wave1 vs wave2 plotted and would like to duplicate the graph with the exact data but the waves in the new graph are called wave1_dup vs wave2_dup as an example.

Thanks in advance.
Yes. You need to write a procedure that grabs the list of waves in your graph and then renames them.


Function Appender(newsuffix)
	String newsuffix
	
	String wnames =wavelist("*",";","WIN:") //WIN: means top graph
	String name, newname
	Variable i
	
	for(i =0;i < itemsinlist(wnames);i +=1)
		name = stringfromlist(i,wnames)
		newname = name + newsuffix
		Rename $name $newname
	endfor
End


Untested but should work. Call example would be
Appender("_dup")
.
Note 1 WIN: means top graph but you could edit this to specify which graph you want to work on.
Note 2 If you want to keep the current graph with wave1, wave2... and make a new graph with wave1_dup, wave2_dup... you need to edit the procedure to duplicate and replace (working on a duplicate of the original graph - cmd+d).
Have a look at
displayhelptopic "ReplaceWave"


There is also a user interface for it: Right-Click on a trace and select "Replace Wave..."
- HJ