WaveStats in Igor Pro
One operation, and a dozen V_ variables land in the local scope.
Function/S Summarize(WAVE w)
WaveStats/Q w
String out
sprintf out, "n=%d mean=%.4g sd=%.4g", V_npnts, V_avg, V_sdev
sprintf out, "%s range=[%.4g, %.4g]", out, V_min, V_max
sprintf out, "%s peak at x=%g", out, V_maxloc
if (V_numNaNs > 0)
out += " (" + num2istr(V_numNaNs) + " NaNs)"
endif
return out
End
How it works
/Qkeeps it out of the history; without it every run prints a table.V_avg,V_sdev,V_min,V_maxandV_npntsare the usual four.V_minlocandV_maxlocare x positions, not point numbers.
Keywords and builtins used here
EndFunctionStringWAVEWaveStatsendififnum2istrreturnsprintf
The run, in numbers
- Lines
- 14
- Characters to type
- 305
- Tokens
- 60
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 45 seconds.
Step 1 of 3 in Measuring, step 5 of 16 in Waves & analysis.