You can specify dimension(s) for internal variables, in order to declare arrays. All indexes are 0 based. For instance, in case of single dimension array, the first element is always identified by ArrayName[0].

To declare an array, enter its dimension in the corresponding column of the variable editor. For a multi-dimension array, enter dimensions separated by comas (ex: 2,10,4).

Use in ST and IL languages

To specify an item of an array in ST and IL language, enter the mane of the array followed by the index(es) entered between "[" and "]" characters. For multi-dimension arrays, enter indexes separated by comas. Indexes may be either constant or complex expressions.

example Example

TheArray[1,7] := value;
result := SingleArray[i + 2];

Use in FBD and LD languages

In graphical languages, the following blocks are available for managing array elements:

Block

Description

[I]>>

Get value of an item in a single dimension array.

[I,J]>>

Get value of an item in a two dimension array.

[I,J,K]>>

Get value of an item in a three dimension array.

>>[I]

Set value of an item in a single dimention array.

>>[I,J]

Set value of an item in a two dimension array.

>>[I,J,K]

Set value of an item in a three dimension array.

For get blocks, the first input is the array and the output is the value of the item. Other inputs are indexes in the array.

For put blocks,  the first input is the forced value and the second input is the array. Other inputs are indexes in the array.

attentionAttention

  • Arrays have at most 3 dimensions.
  • All indexes are 0 based.
  • The total number of items in an array (merging all dimensions) cannot exceed 10000000. The possible range of Arrays reaches from ArrayName[0] until ArrayName[9999999].
  • The support of arrays with more than 54534 elements requires the option “complex variables in a separate segment” to be enabled, and may be not supported by some target systems.
  • Some operations may be impossible with arrays bigger than 65534 elements, such as passing the array as a parameter to a system function block.

Created with the Personal Edition of HelpNDoc: Converting Word Docs to eBooks Made Easy with HelpNDoc