Trouble with Liberal Names
Hi all,
I'm making a series of procedures to help speed up processing of a 2D data set. This involves chopping the main 2D wave up into smaller 2D waves. Each smaller 2D wave then gets its own graph of 1D slices from said smaller 2D wave.
The problem I'm running into is mainly that, as far as I can tell, there is no way to rename traces (if there is, please let me know), and #NameOfTrace87 is not particularly informative. Thus, I'm extracting each 1D slice as its own wave so that I can give it a unique name. My routine to do this is as follows:
String TraceToPull = GetWavesDataFolder(w0,2) + num2str(VWave[i]) + "V"
String TempNameCounter = "TempName" + num2str(i)
Duplicate/D/O/R=[][i] w0,$TempNameCOunter
WAVE PulledTrace = $TempNameCounter
AppendToGraph PulledTrace vs WLWave
string cmd
sprintf cmd, "Rename $TempNameCounter", PossiblyQuoteName(TraceToPull)
Execute cmd
EndFor
I had Igor output the slices as $TempNameCounter as a sanity check. It does this just fine, and the names of these traces are perfectly acceptable to Igor (just alphanumeric characters). Great. However, no matter what I do, I simply cannot get Igor to use a liberal name for any of these. The three lines starting at "string cmd" are copied straight out of the Manual in the section "Programming with Liberal Names." The use of liberal names here is very desirable, as the values in VWave contain decimal places that can't be omitted (i.e., they're between 0 and 2 and so I can't just make them integers). Also, some of them are negative, and the negative sign is helpful to have visible.
I appreciate any light you can shed on my situation. Thank you in advance!
Will
Update - a colleague reminded me that path names must have the ' marks between the :. I changed it to:
String TraceToPull = GetWavesDataFolder(w0,1) + "'" + NameOfWave(w0) + num2str(VWave[i]) + "V'"
String TempNameCounter = "TempName" + num2str(i)
Duplicate/D/O/R=[][i] w0,$TraceToPull
WAVE PulledTrace = $TraceToPull
AppendToGraph PulledTrace vs WLWave
EndFor
and it works fine now.
Best,
Will
December 4, 2024 at 01:58 pm - Permalink
As for the uninformative names for your traces using slices from a 2D wave, it is possible to give a trace a name different from what Igor would give it using the /TN flag. It goes after the Y wave name, like this:
Make junkx = x
Display;
AppendToGraph junk/TN=MySpecialJunk vs junkx
If the trace name is a liberal name, enclose it in single quotes.
December 4, 2024 at 02:15 pm - Permalink
That's great, thank you, John!
December 4, 2024 at 02:18 pm - Permalink
That's probably the first time I realize that non-liberal names can also be enclosed in single quotes just fine. Then what's PossiblyQuoteName() for? :-)
December 5, 2024 at 06:38 pm - Permalink