typestar

Lists in a string in Igor Pro

Igor's list is a delimited string, and a handful of functions treat it as a sequence.

Function ShowWaves()
    String list = WaveList("data_*", ";", "")
    Variable i, n = ItemsInList(list)

    for (i = 0; i < n; i += 1)
        String name = StringFromList(i, list)
        WAVE w = $name
        Printf "%-20s %d points\r", name, numpnts(w)
    endfor

    list = AddListItem("summary", list, ";", inf)
    Print ItemsInList(list, ";")
End

How it works

  1. ItemsInList counts; StringFromList reads one item by index.
  2. AddListItem and RemoveFromList return a new list.
  3. WaveList and TraceNameList hand you lists in exactly this form.

Keywords and builtins used here

The run, in numbers

Lines
13
Characters to type
309
Tokens
81
Three-star pace
75 tpm

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

Type this snippet

Step 2 of 4 in Text, step 13 of 18 in Language basics.

← Previous Next →