This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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

Simulink.SimulationData.Unit.setName

Specify name of logging data unit

Copy Semantics

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

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