typestar

Variables and strings in Igor Pro

Igor has few types and they are all declared: numbers, text, and references to waves.

Constant kSampleRate = 20000
StrConstant ksUnit = "mV"

Function Describe()
    Variable gain = 4.7
    Variable count = 12
    String name = "trace_a"
    String note = name + " at " + num2str(gain) + " " + ksUnit

    Print note, count / kSampleRate
End

How it works

  1. Variable is a double; String is text; there is no separate integer.
  2. A local declaration can initialize on the same line.
  3. Constant and StrConstant are file-level and cannot change.

Keywords and builtins used here

The run, in numbers

Lines
11
Characters to type
235
Tokens
46
Three-star pace
70 tpm

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

Type this snippet

Step 1 of 3 in Variables & functions, step 5 of 18 in Language basics.

← Previous Next →