Naming graph windows and avoiding Igor renaming
Hello,
A few times I've run into the following problem: it seems that new graph windows cannot be named using the name of an existing wave. This doesn't seem to be documented - maybe I missed it.
An example:
Make/O aaa,bbb
String plotName = "aaa"
KillWindow/Z $plotName
Display/N=$plotName aaa vs bbb
plotName = "ccc"
KillWindow/Z $plotName
Display/N=$plotName aaa vs bbb
End
This gives two windows, one named aaa0 and one called ccc. If the function is run again, ccc is killed and recreated but aaa0 remains (obviously) and aaa1 is created. This is a silly example, I do try to create plotNames that are not identical e.g. by using a prefix and then the wave name.
In the help it does say that you can use the S_name string to know what name Igor actually gave to the window, but this isn't ideal because then I would have to pass that string on to subsequent functions rather than having them work out the plotName for themselves.
I guess my question is whether this is a bug or feature?
p.s. in the help it recommends DoWindow/K for killing, I thought KillWindow is the new standard for functions?
This may not be a satisfying answer to your question, but I never give graphs a specific name and rather look up the name with WinName(0,1). Is this a solution for your task? Of course this will be inconvenient if the graph you want to attack is not the top graph, but the you may work on it with WinList("thenameofyourdata*", ";", "WIN:1").
November 16, 2018 at 07:09 am - Permalink
In reply to This may not be a satisfying… by chozo
DisplayHelpTopic "Name Spaces"
See the table below that shows the four global name spaces:
Waves, variables, windows Names must be distinct from other waves, variables (numeric and string), windows.
November 16, 2018 at 08:26 am - Permalink
Setting window names in a function can be perilous. This is a copy of an email exchange with Howard Rodstein from a year ago:
November 16, 2018 at 08:40 am - Permalink
Thanks all for the replies.
@chozo - I could do this. Thanks for the suggestion.
@aclight - this answers my question. It's just the way it is.
@tony - I hadn't thought about other conflicts. Checking the name makes sense.
November 16, 2018 at 08:58 am - Permalink