Please explain how the $ works
The code below works. I got it from someone else. It searches through each of the waves in the list of Metwaves and replaces the "nan" with a "-999". What I don't understand is what the dollar sign does, how it works and more importantly when to or not or use it. The values in the original wave are changed but there is no direct mechanism that reassigns the changed values in "tempwave" back to the original wave. Any clarification/explanation is appreciated. Thanks,
ssmith
Make/O/T Metwaves = {"temp_2", "temp_10", "temp_50", "temp_85", "speed_10", "speed_50", "speed_85","gust_10", "gust_50", "gust_85", "dir_10", "dir_50",
"dir_85", "deviation_10", "deviation_50", "deviation_85", "rh", "baro", "solar", "precip"}
Variable selects
FOR(selects = 0; selects < (numpnts(Metwaves)); selects += 1)
Wave tempwave = $Metwaves[selects]
tempwave = (numtype(tempwave) == 2) ? -999 : tempwave[p]
ENDFOR
$ is used when a command requires a name but you have only a String.
It converts the contents of the string into a name.
Look at the command syntax for WAVE:
pathToWave isn't shown as pathToWaveStr, just pathToWave.
Without the Str ending, that's a hint that the parameter is a name, like for the Make command:
Thus code like this won't work:
But this will:
For more about this, use this command:
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
April 25, 2017 at 12:55 pm - Permalink
I've added comments to the code:
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
April 25, 2017 at 01:06 pm - Permalink
ssmith
April 26, 2017 at 05:42 am - Permalink
April 27, 2017 at 10:08 am - Permalink