How to solve this trace name issue?
Sat, 02/27/2021 - 11:57 am
I have hit this some time ago and solved this way described below. But I am bit puzzled since I would expect easier solution.
I have code which appends to graph waves - SourceInWv vs SourceQWv and adds error bars using wave SourceErrorWave
ErrorBars /W=$(GraphWindowName) $(NameOfWave(SourceIntWv)) Y,wave=(SourceErrorWv,SourceErrorWv)
Now, this is a loop going through number of wave triplets. If the names are unique, this is perfectly fine code.
The trouble becomes when the wave names are the same and they are located in different folders. This is, unluckily, common case for me. In this case NameOfWave(SourceInWave)) returns name of wave which is not name name of trace -- but the trace name is needed for ErrorBars command.
Now, my solution is to use /TN= to make sure I know what the trace name is:
ErrorBars /W=$(GraphWindowName) $(NewTraceName) Y,wave=(SourceErrorWv,SourceErrorWv)
but now I have to worry about uniqueness of the NewTraceName, which previously I did not.
I searched through manual to figure out if there is something returned by AppendToGraph command to tell me, what I actually did append... I can surely interrogate recreation macros before and after to figure this out, but all of this seems ridiculously complicated for something which in its way is simple question: "what did I ended up appending"?
I am sure there must be simple solution. Can someone educate me, please? Thank you...