Cursors in Igor Pro
Cursors A and B mark points on a trace, and a function can read or place them.
Function AnalyzeBetweenCursors()
if (strlen(CsrInfo(A)) == 0 || strlen(CsrInfo(B)) == 0)
Print "place both cursors first"
return NaN
endif
WAVE w = CsrWaveRef(A)
Variable first = min(pcsr(A), pcsr(B))
Variable last = max(pcsr(A), pcsr(B))
WaveStats/Q/R=[first, last] w
Printf "%g to %g: mean %g\r", xcsr(A), xcsr(B), V_avg
return V_avg
End
How it works
Cursor/Pplaces one by point number; without it, by x value.pcsr(A)reads the point,xcsr(A)the x value,CsrWavethe trace.- That is how an analysis works on the region a user selected.
Keywords and builtins used here
CsrInfoCsrWaveRefEndFunctionNaNPrintPrintfVariableWAVEWaveStatsendififmaxminpcsrreturnstrlenxcsr
The run, in numbers
- Lines
- 14
- Characters to type
- 341
- Tokens
- 95
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 67 seconds.
Step 3 of 4 in Marking it up, step 14 of 19 in Graphs & presentation.