tsunion

Class: opc.hda.Data
Package: opc.hda

Union of time stamps in an OPC HDA data object

Syntax

NewObj = tsunion(DObj)
NewObj = tsunion(DObj, 'linear')
NewObj = tsunion(DObj, 'hold')
NewObj = tsunion(DObj, 'nearest')
NewObj = tsunion(DObj, 'spline')
NewObj = tsunion(DObj, 'pchip')

Description

NewObj = tsunion(DObj) merges the time stamps of all items (elements) in data object DObj, so that each element of NewObj has the same time stamp vector corresponding to all possible time stamps in all elements of DObj. For each element, values are linearly interpolated or extrapolated where that time stamp does not exist for an item (element of the Data object).

If DObj contains elements with the same item ID, those elements are combined into one element. So the size of NewObj might be smaller than the size of DObj.

Quality for the resampled data is set as follows:

  • All original values retain their quality.

  • All interpolated values get a quality of Interpolated: Good.

  • All extrapolated values get a quality of Interpolated: Sub-Normal.

NewObj = tsunion(DObj, 'linear') uses linear interpolation.

NewObj = tsunion(DObj, 'hold') uses a zero-order hold interpolation where the previous known value is used for all new time stamps. Any time stamp prior to the first known value is set to NaN (or 0 if the value is a fixed-point data type).

NewObj = tsunion(DObj, 'nearest') uses nearest-neighbor interpolation as defined by interp1.

NewObj = tsunion(DObj, 'spline') uses spline interpolation as defined by interp1.

NewObj = tsunion(DObj, 'pchip') uses shape-preserving, piece-wise, cubic interpolation as defined by interp1.

For data objects containing string values, only the 'hold' method can be used.

Examples

Load the OPC HDA example data file and find the time stamp union of hdaDataSmall:

load opcdemoHDAData;
newObj = tsunion(hdaDataSmall);

Find the union using 'hold' resampling:

newObjHold = tsunion(hdaDataSmall, 'hold');
Was this topic helpful?