readItemAttributes
Package: opc.hda
Read item attribute values from OPC HDA server
Syntax
S = readItemAttributes(HdaObj, ItemID, Attribute,
StartTime, EndTime)
Description
S = readItemAttributes(HdaObj, ItemID, Attribute,
StartTime, EndTime)
reads item attribute values for the opc.hda.ItemAttributes
item with ID
ItemID
. HdaObj
must be a scalar OPC HDA
client that is already connected to the server.
ItemID
is a character vector or string containing the item ID
for which attributes are requested. Attribute
is the requested
attribute for the item, specified either as a character vector or string as the ID
for that attribute. StartTime
and EndTime
are
MATLAB date numbers representing the start and end times of the period over which
data must be aggregated.
S
is returned as a structure array containing fields
ItemID
, AttributeID
,
TimeStamp
and Value
.
ItemID
is the item ID requested.
AttributeID
is the numeric ID of the attribute requested.
TimeStamp
is a vector containing the time stamps when the
attribute was updated. Value
is the value that the attribute was
changed to at each time in TimeStamp
.
The ItemAttributes
property of the connected client object
HdaObj
contains all valid item attributes for the
server.
Examples
Retrieve the current data type of the 'Random.Real8'
property:
hdaObj = opchda('localhost','Matrikon.OPC.Simulation'); connect(hdaObj); attrStruct = hdaObj.readItemAttributes('Random.Real8', ... hdaObj.ItemAttributes.DATA_TYPE,now,now)
Version History
Introduced in R2011a