Wave assignment in Igor Pro
One line does what a loop would: the assignment runs over every point.
Function BuildSignals()
Make/O/N=500/D raw, baseline, corrected
SetScale/P x, 0, 0.002, "s", raw, baseline, corrected
raw = sin(2 * pi * 5 * x) + gnoise(0.1)
baseline = 0.3 * x
corrected = raw - baseline
corrected = abs(corrected) < 0.05 ? 0 : corrected
End
How it works
pis the point index,xthe scaled position,qthe second dimension.- The right side may name other waves; they line up point by point.
- A conditional assignment uses
?:, so filtering needs no loop either.
Keywords and builtins used here
EndFunctionMakeSetScaleabsgnoisepisin
The run, in numbers
- Lines
- 9
- Characters to type
- 258
- Tokens
- 70
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 52 seconds.
Step 1 of 4 in Wave assignment, step 1 of 16 in Waves & analysis.