Wave references in Igor Pro
A WAVE reference is how a function holds onto a wave without knowing its name.
Function Process(String name)
WAVE/Z src = $name
if (!WaveExists(src))
Print "no wave called", name
return -1
endif
Duplicate/O src, $(name + "_smooth")
WAVE dest = $(name + "_smooth")
Smooth 5, dest
return 0
End
How it works
WAVE w = namebinds a reference;$binds one from a string.WaveExistsis the check to make before using one./Zon the reference stops the compiler complaining when it may be missing.
Keywords and builtins used here
DuplicateEndFunctionPrintSmoothStringWAVEWaveExistsendififreturn
The run, in numbers
- Lines
- 14
- Characters to type
- 215
- Tokens
- 53
- Three-star pace
- 70 tpm
At the three-star pace of 70 tokens a minute, this run takes about 45 seconds.
Step 3 of 4 in Waves, step 3 of 18 in Language basics.