There are two kinds of variables in HALCON, corresponding to the two parameter types of HALCON: iconic objects (images, regions, and XLDs) and control data (numbers, strings, handles). The corresponding variables are called iconic and control variables. These variables can possess a value or can be undefined. An undefined variable is created, for example, when loading a program or after inserting an operator with a new variable that is not executed immediately into a program. You can access these undefined variables only by writing to them. If you try to read such a variable, a runtime error occurs. If a variable obtains a value, the variable type is specified more precisely. A control variable that contains, for example, an integer is of type integer. This type might change to real or a tuple of integer after specifying new values for this variable. But it always remains a control variable. Similarly, this is the case for iconic variables, which can contain regions, images, or XLDs. You can assign new values to an iconic variable as often as you want to, but you cannot change its type so that it becomes a control variable.
New variables are created in the operator dialog area during specification of operator or procedure call parameters. Here, every sequence of characters without single quotation marks is interpreted as a variable name. If this name did not exist before, the variable is created in the operator dialog area by pressing OK or Enter. The variable type is specified through the type of the parameter where it was used for the first time: Variables that correspond to an iconic object parameter create an iconic variable; variables for a control parameter create a control variable. Every time an operator or procedure call is executed, the results are stored in variables connected to its output parameters. This is achieved by first deleting the contents of the variable and then assigning the new value to it.
The variable window is similar to a watch window used in window-oriented debuggers. Inside this window you are able to keep track of variable values. Corresponding to the two variable types, there are two areas in the variable window. One for iconic data (above or left) and the other for control data (below or right). You can toggle the orientation of the two parts of the variable window. To do this, double-click the dividing line between both parts. You can also drag that line to resize the parts.
All computed variables are displayed showing their iconic or control values (unless the automatic update has been switched off, see section “Runtime Settings ▹ Runtime Settings”). In case of a tuple result that is too long, the tuple presentation is shortened, indicated by three dots. In this case, the full content of a variable can be displayed in an inspection window by double-clicking the value list. See also the following sections.