Subranges in Igor Pro
Square brackets take points; parentheses take x values. The difference matters.
Function TrimAndPatch(WAVE w)
Variable first = w[0]
Variable atHalf = w(0.5)
w[0, 9] = 0
w[numpnts(w) - 10, inf] = 0
Duplicate/O/R=[100, 199] w, window
Printf "kept %d points around %g\r", numpnts(window), atHalf
End
How it works
w[10, 20]is a range of points, ends included.w(0.5)interpolates at an x value instead.- A subrange works on the left of an assignment too.
Keywords and builtins used here
DuplicateEndFunctionPrintfVariableWAVEinfnumpntswindow
The run, in numbers
- Lines
- 10
- Characters to type
- 218
- Tokens
- 63
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 47 seconds.
Step 2 of 4 in Wave assignment, step 2 of 16 in Waves & analysis.