### 5 Data encoding

### 5.2 OPC UA Binary

## 5.2.5 Arrays

One dimensional *Arrays* are encoded as a sequence of elements preceded by the number of elements encoded as an *Int32* value.

Multi-dimensional *Arrays* have an encoding that depends on where they are used. When a multi-dimensional *Array* is the *Value* of an *Attribute* it uses the *Variant* encoding described in 5.2.2.16.

When a multi-dimensional *Array* is a field of a *Structure* (see 5.2.6) it shall be encoded with the inline matrix representation as shown in Table 17.

**Table 17** **– Inline Matrix DataEncoding**

Name |
Data Type |
Description |
---|---|---|

Dimensions | Int32 [] | The length of each dimension. If any dimension has a length <= 0, then no values are encoded.The number of dimensions shall be at least 2. |

Values | * | The values encoded sequentially according to its built-in data type. The total number of values is the product of the dimensions.The mapping of a multidimensional array to a flat list is described in 5.2.2.16. |

The inline matrix representation is not supported by earlier versions of this specification. This means any *Structure* with a field or nested field mapped to an inline matrix is not compatible with the deprecated *DataTypeDictionary* mechanism, and shall not be included in a *DataTypeDictionary*.

If an *Array* is null, then its length is encoded as −1. See 5.1.9 for a discussion of zero-length vs null arrays.