Products & Services Solutions Academia Support User Community Company

Learn more about OPC Toolbox   

Understanding Array Formatted Data

Array Content

OPC Toolbox software can return arrays of Value, Quality, and TimeStamp information from a logging task. You can retrieve arrays from memory using getdata, or from disk using opcread, by specifying the data type as 'cell' or any MATLAB numeric array data type, such as 'double' or 'uint32'. Consult the function reference pages for details on how to specify the data type.

When you request array formatted data, the toolbox returns arrays of each of the following elements of the records in memory or on disk:

Conversion of Logged Data to Arrays

When you request array formatted data from getdata or opcread, you must define the desired data type for the returned Value array. OPC Toolbox software automatically converts each record of logged data from the item's data type (defined by the DataType property of that item) to the requested data type.

When converting logged data to arrays, the toolbox must consider two factors when populating the returned arrays:

Treatment of Missing Data

When OPC Toolbox software logs data, each logged record may not contain all items in the logging task. When converting the data to array format, every item involved in the logging task must be allocated a value, a quality, and a time stamp for each record. Therefore, in a logging task there may be "missing" data for a particular item in a particular record. The toolbox uses the following rules to determine how to fill the missing entry in each array:

Treatment of Array Data Values

For each record stored in memory or on disk during a logging task, a single item may return an array of values. When converting logged data to array format, each item in each record has only one entry in the Value array allocated to that record and item.

For the 'cell' data type, OPC Toolbox software is able to store the array returned as the Value for that element, because a MATLAB cell array is able to store any data type of any size in each element of the cell array.

For numeric data types, such as 'double' or 'uint32', the resulting Value array provides space for only a single value. Consequently, if an array value is found in a logging task, and you have requested a numeric array data type, an error will be generated. You must use the 'cell' data type or the structure format to return logged data that contains arrays as values.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS