Main Content

Simulink.SimulationData.Unit class

Package: Simulink.SimulationData
Superclasses:

Store units for simulation data

Description

Simulink® creates Simulink.SimulationData.Unit objects to store unit information for signals when:

  • Performing signal logging, which uses the Dataset format

  • Logging root Outport blocks, if in Configurations Parameters you select the Output parameter and set Format to Dataset

  • Logging to a To Workspace block or To File block, if you set the Save format block parameter to the default of Timeseries

Construction

unitsObj = Simulink.SimulationData.Unit(unitName) creates a Simulink.SimulationData.Unit object with the unit that you specify.

Input Arguments

expand all

Name of logging data units, specified as a character vector.

Output Arguments

expand all

Logging data units, returned as a Simulink.SimulationData.Unit object.

Properties

expand all

Name of the units, specified as a character vector.

Methods

Method

Purpose

setName

Specify name of logging data unit

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects.

Examples

collapse all

Create a Simulink.SimulationData.Unit object representing inches.

inchesUnit = Simulink.SimulationData.Unit('inches');

Create a MATLAB® timeseries object and set its Units field to the Simulink.SimulationData.Unit object.

ts = timeseries(1:10);
ts.DataInfo.Units = inchesUnit;
ts.DataInfo.Units
ans = 

  Units with properties:

    Name: 'inches'
Introduced in R2016a