typestar

Printing in Igor Pro

Print for a quick look, printf when the shape of the output matters.

Function ShowStats(WAVE w)
    WaveStats/Q w

    Print "points:", V_npnts

    Printf "mean %.3f, sd %.3f\r", V_avg, V_sdev
    Printf "range %g to %g\r", V_min, V_max

    String summary
    sprintf summary, "%s: n=%d", NameOfWave(w), V_npnts
    Print summary
End

How it works

  1. Print takes a comma-separated list and formats it for you.
  2. Printf takes a format string and needs the trailing \\r itself.
  3. sprintf writes into a string instead of the history.

Keywords and builtins used here

The run, in numbers

Lines
12
Characters to type
238
Tokens
41
Three-star pace
75 tpm

At the three-star pace of 75 tokens a minute, this run takes about 33 seconds.

Type this snippet

Step 3 of 4 in Text, step 14 of 18 in Language basics.

← Previous Next →