Main Content

Simulink.sdi.getUnitSystem

Get current unit system configured in Simulation Data Inspector preferences

Since R2020b

    Description

    unitSystem = Simulink.sdi.getUnitSystem returns the unit system configured in the Simulation Data Inspector preferences. For more information about unit preferences, see Signal Display Units. To specify unit preferences for the Simulation Data Inspector, use the Simulink.sdi.setUnitSystem function.

    example

    [unitSystem,overrideUnits] = Simulink.sdi.getUnitSystem returns the unit system and override units configured in the Simulation Data Inspector preferences.

    Examples

    collapse all

    To specify a system of units to use for plotting signals in the Simulation Data Inspector, use the Simulink.sdi.setUnitSystem function. When you choose to display signals using the SI or US Customary unit system, the Simulation Data Inspector automatically changes the Display Units property for logged or imported signals that use units that are not part of the specified unit system. The signal data stored on disk does not change. Signals also have a Stored Units property, and the Simulation Data Inspector converts the data to plot the signal when the Stored Units and Display Units differ.

    Specify a System of Units

    By default, the Simulation Data Inspector displays signals using the units assigned to the signal during simulation or in the imported data. To facilitate analyzing multiple signals and data sets together, you can specify a system of units as a preference. The Simulation Data Inspector automatically updates the Display Units for logged or imported signals that use units that are invalid in the specified unit system. For example, a signal logged in a model using units of ft could be updated to use units of m when the system of units is specified as SI.

    Use the Simulink.sdi.setUnitSystem function to configure the Simulation Data Inspector to display signals using units in the US Customary unit system.

    Simulink.sdi.setUnitSystem('USCustomary');

    Specify Override Units

    When you want all signals that represent the same type of measurement to use the same Display Units, you can also specify override units. For example, to plot all signals that represent length using units of ft, specify ft as an override unit.

    Simulink.sdi.setUnitSystem('USCustomary','Overrides',"ft");

    Check Unit Configuration

    Use the Simulink.sdi.getUnitSystem function to check the current unit preferences configured in the Simulation Data Inspector.

    [unitSystem,overrideUnits] = Simulink.sdi.getUnitSystem
    unitSystem = 
    'USCustomary'
    
    overrideUnits = 
    "ft"
    

    Output Arguments

    collapse all

    System of units used to define signal display units, returned as a character vector.

    Units to override signal display units, returned as a string or string array. The Simulation Data Inspector displays all signals that represent a measurement type using specified override units. For example, if override units of in are specified, the Simulation Data Inspector displays all signals that represent length using units of in.

    Version History

    Introduced in R2020b