Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 containing the item ID for which attributes are requested. Attribute is the requested attribute for the item, specified either as a character vector or 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 stamp(s) 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)

Introduced in R2011a

Was this topic helpful?