typestar

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

  1. /Q keeps it out of the history; without it every run prints a table.
  2. V_avg, V_sdev, V_min, V_max and V_npnts are the usual four.
  3. V_minloc and V_maxloc are x positions, not point numbers.

Keywords and builtins used here

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.

Type this snippet

Step 1 of 3 in Measuring, step 5 of 16 in Waves & analysis.

← Previous Next →