Content of Wave Reference Waves
ChrLie
Apologies if I missed an option in the documentation, but is there a way to view the content of wave reference waves, i.e. to see full paths of referenced waves in a table?
If not, could this information maybe be stored as wave note?
You can grab the full path from the wave reference wave yourself as in
Make/FREE dataFree = p
Make/O dataPerm = p^2
Make/O/WAVE container = {dataFree, dataPerm}
Edit container.ld
printf "Path %s\r", GetWavesDataFolder(container[0], 2)
printf "Path %s\r", GetWavesDataFolder(container[1], 2)
End
which outputs
Path root:dataPerm
as only permanent waves have a datafolder where they reside in.
August 22, 2022 at 08:14 am - Permalink
Try this:
Make/WAVE ww = {jack, fred}
Edit ww
Now choose Table->Show Column Info Tags.
Now hover the mouse over the two wave elements in the table. The column info tag shows the wave to which the element points.
August 22, 2022 at 09:20 am - Permalink
Thanks Thomas and Howard!
I was looking for an option to quickly see the content based out of the data browser without dealing with commands. The last option kind of works for me but it's not as quick as I wished.
PS: Well, actually something like this works better
menu "DataBrowserObjectsPopup"
"Show Wave References", /Q, ShowWRefWaves()
end
function ShowWRefWaves()
string item = GetBrowserSelection(0)
if (strlen(item) == 0)
return 0
endif
wave/wave/z w=$item
if(wavetype(w, 1) != 4)
print "Wrong wave/object type!"
return -1
endif
variable i, nPts=numPnts(w)
for(i=0; i<nPts(w); i++)
print GetWavesDataFolder(w[i], 2)
endfor
return 1
end
PPS: "DataBrowserObjectsPopup" --> great feature!!
August 22, 2022 at 11:59 pm - Permalink
In reply to Thanks Thomas and Howard! I… by ChrLie
If you want to make this a bit fancier, you can use this code:
Menu "DataBrowserObjectsPopup", dynamic
// This menu item is displayed if a single wave reference wave is selected
DisplayWaveRefMenuItemString(), /Q, DisplayWaveReferences()
End
// If only one wave reference wave is selected in the Data Browser
// object list, this function returns the selected wave
// via w1 and returns 1. Otherwise the function returns 0
// and the w1 parameter may be null.
static Function GetSelectedWaveRefWave(WAVE/Z &w1)
if (strlen(GetBrowserSelection(-1)) == 0)
return 0 // Data Browser is not open
endif
WAVE/Z w1 = $(GetBrowserSelection(0)) // May be null
if (!WaveExists(w1) || strlen(GetBrowserSelection(1)) > 0)
return 0 // Too few or too many waves selected
endif
if (WaveType(w1,1)!=4)
return 0 // Wave is not a wave reference wave
endif
return 1
End
Function/S DisplayWaveRefMenuItemString()
WAVE/Z w1, w2
int oneWaveRefWaveSelected = GetSelectedWaveRefWave(w1)
if (!oneWaveRefWaveSelected)
return ""
endif
String menuText
sprintf menuText, "Show Wave References"
return menuText
End
Function DisplayWaveReferences()
WAVE/Z w1
int oneWaveRefWaveSelected = GetSelectedWaveRefWave(w1)
if (oneWaveRefWaveSelected)
WAVE/WAVE w1Ref = w1
variable i, nPts=numPnts(w1Ref)
for(i=0; i<nPts; i++)
WAVE/Z thisWave = w1Ref[i]
if (WaveExists(thisWave))
print GetWavesDataFolder(thisWave, 2)
else
print "<null>"
endif
endfor
endif
End
#endif // IP9+
That will cause the "Show Wave References" contextual menu item to be hidden except when only one wave reference wave is selected.
August 23, 2022 at 08:20 am - Permalink
Fancy indeed, Thanks!
August 23, 2022 at 11:19 pm - Permalink