opcstruct2array - Convert OPC data from structure to array format

Syntax

[ItmID,Val,Qual,TStamp,EvtTime] = opcstruct2array(S)
[ItmID,Val,Qual,TStamp,EvtTime] = opcstruct2array(S,'DataType')

Description

[ItmID,Val,Qual,TStamp,EvtTime] = opcstruct2array(S) converts the OPC data structure S into separate arrays for the item ID, value, quality, time stamp, and event time. S must be a structure as returned by the getdata and opcread functions. S must contain the fields LocalEventTime and Items. The Items field of S must contain the fields ItemID, Value, Quality, and TimeStamp.

ItmID is a 1-by-nItm cell array containing the item IDs of all unique items found in the ItemID field of the Items structures in S.

Val is an nRec-by-nItm array of doubles containing the value of each item in ItmID, at each time specified by TStamp.

Qual is an nRec-by-nItm cell array of strings containing the quality of each value in Val.

TStamp is an nRec-by-nItm array of doubles containing the time stamp for each value in Val.

EvtTime is nRec-by-1 array of doubles containing the local time each data change event occurred.

Each row of Val represents data from one record received by OPC Toolbox™ software at the corresponding entry in EvtTime, while each column of Val represents the time series for the corresponding item ID in ItmID.

[ItmID,Val,Qual,TStamp,EvtTime] = opcstruct2array(S,'DataType') uses the data type specified by the string 'DataType' for the value array. Valid data types are 'double', 'single', 'int8', 'int16', 'int32', 'uint8', 'uint16', 'uint32', 'logical', 'currency', 'date', and 'cell'.

See Also

getdata, opcread

  


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