readRaw

Package: opc.hda

Read raw data stored over a time range from HDA server

Syntax

DObj = readRaw(HdaClient, ItmList, StartTime, EndTime)
DObj = readRaw(HdaClient, ItmList, StartTime, EndTime, BoundsFlag)

Description

DObj = readRaw(HdaClient, ItmList, StartTime, EndTime) reads data from the items defined by ItmList, stored on the OPC HDA server connected to OPC HDA Client HdaClient, between StartTime (inclusive) and EndTime (exclusive). The StartTime and EndTime arguments must be date numbers, or strings that can be converted to a MATLAB® date number. DObj is returned as an opc.hda.Data array, with one element per item specified in ItmList.

DObj = readRaw(HdaClient, ItmList, StartTime, EndTime, BoundsFlag) allows you to specify a bounds flag. If BoundsFlag is true, then the first data point on or outside the defined start and end times will be returned. If BoundsFlag is false, then only values that were time stamped between StartTime (inclusive) and EndTime (exclusive) will be included.

Note that one or more time stamps returned for each item may be unique to that item. To retrieve aligned data from an OPC HDA Server, use readAtTime or readProcessed.

Examples

Create an OPC HDA Client and connect the client to the server:

hdaObj = opchda('localhost', 'Matrikon.OPC.Simulation');
connect(hdaObj);

Read the last day's data from two items:

DObj = readRaw(hdaObj, {'Random.Real8', 'Random.Real4'}, now-1, now);
Was this topic helpful?