Contenido principal

tsunion

Union of timestamps in OPC HDA data object

Description

newObj = tsunion(dObj) merges the timestamps of all items (elements) in data object dObj, so that each element of newObj has the same timestamp vector corresponding to all possible timestamps in all elements of dObj. When an item (element of the Data object) has no value corresponding to a timestamp, the function defines a value at that timestamp by linear interpolation or extrapolation.

If dObj contains elements with the same item ID, the function combines those elements into one element. So the size of newObj can 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,interpolationType) uses the specified interpolationType.

example

Examples

collapse all

Load the OPC HDA example data file and find the union of timestamps in hdaDataSmall.

load opcSampleHdaData;
newObj = tsunion(hdaDataSmall);

Find the union using 'hold' resampling.

newObjHold = tsunion(hdaDataSmall, 'hold');

Input Arguments

collapse all

Raw OPC HDA data, specified as an OPC HDA data object.

Type of interpolation on the data in DObj, specified as one of these values:

  • 'linear': Linear interpolation.

  • 'hold': Zero-order hold interpolation, where the previous known value is used for all new timestamps. Any timestamp prior to the first known value is set to NaN (or 0 if the value is a fixed-point data type).

  • 'nearest': Nearest-neighbor interpolation as defined by interp1.

  • 'spline': Spline interpolation as defined by interp1.

  • 'pchip': Shape-preserving, piece-wise, cubic interpolation as defined by interp1.

Output Arguments

collapse all

Resampled OPC HDA data, returned as an array of OPC HDA data objects. Each element in the array corresponds to one item.

Version History

Introduced before R2006a

See Also

Functions