Language basics
18 steps in 6 sets of Igor Pro.
Igor's procedure language is small, and most of it exists to move waves around. This tour covers the parts you cannot avoid: making a wave and giving it a scale, the handful of types Igor has, functions and their flag-carrying return declarations, and the flow control that closes with spelled-out keywords rather than braces.
Two things surprise people arriving from other languages. There are no booleans, so zero is false and everything else is true. And a wave assignment runs over every point at once, which means most of the loops you are about to write are unnecessary. The Encore is a wave toolkit that puts the whole lot together.
Waves
- Making a waveA wave is the thing Igor is built around: a named, numbered array that knows its own axis.
- Waves know their axisThe point number p is not the x value: SetScale is what ties a wave to real units.
- Wave referencesA WAVE reference is how a function holds onto a wave without knowing its name.
- Cleaning upAn experiment fills with scratch waves; the kill operations are how a script tidies after itself.
Variables & functions
- Variables and stringsIgor has few types and they are all declared: numbers, text, and references to waves.
- FunctionsA function declares what it returns before its name, and closes with End.
- Optional and by-reference parametersIgor has no overloading; optional parameters and by-reference outputs do that work.
Flow control
- Conditionsif/elseif/else, and the ternary operator for the small cases.
- Loopsfor and do-while, and the reminder that a wave assignment usually beats both.
- switchA numeric switch, where a case without break falls into the next one.
- strswitchThe same shape for strings — and note it still closes with endswitch.
Text
- Working with textIgor's string toolkit is small and every piece of it is a function.
- Lists in a stringIgor's list is a delimited string, and a handful of functions treat it as a sequence.
- PrintingPrint for a quick look, printf when the shape of the output matters.
- Text wavesA text wave holds strings, and most numeric operations do not apply to it.
Where data lives
- GlobalsA global lives in a data folder; NVAR and SVAR are the references that reach it.
- Data foldersIgor's experiment is a tree, and data folders are how an analysis keeps its work apart.
Encore
- wave_toolkit.ipfThe small utility functions every Igor project ends up writing, in one file.