Main Content

Modify Signal Properties in the Simulation Data Inspector

You can modify signal display units, data type, and names in the Simulation Data Inspector. When you modify the data type for a signal, the Simulation Data Inspector converts the signal values stored on disk. Changes you make to signal properties in the Simulation Data Inspector do not affect any models, files, or workspace variables.

You may want to save the original signal data or export modified signal data to use as simulation input. You can export data from the Simulation Data Inspector to the workspace or a file. For more information, see Export Data from the Simulation Data Inspector.

This example uses data from a simulation of the slexAircraftExample model. To generate the data for this example:

  1. Enter slexAircraftExample in the MATLAB® Command Window.

  2. To log the q, rad/sec, the Stick, and the alpha, rad signals to the Simulation Data Inspector, select the signals in the model. Then, right-click the selection, and select Log Selected Signals from the context menu.

  3. Double-click the Pilot block. Set Wave form to sine, and click OK.

  4. Simulate the model.

Modify Signal Units

Signals in the Simulation Data Inspector have two unit properties: display units and stored units. To analyze sets of data using consistent units, modify the display units for a signal. The Simulation Data Inspector converts data when the stored units and display units for a signal differ such that signals are always plotted using values that correspond to the display units. The units you specify are properties of the signals in the Simulation Data Inspector only and do not affect the signal properties in models. To learn how to specify units in a model, see Unit Specification in Simulink Models.

The slexAircraftExample model does not specify units for its signals. However, some signal names indicate the intended units.

  1. In the Inspect pane, select the alpha, rad signal.

  2. To view the properties for the selected signal, expand the Properties pane.

  3. To specify units of radians for the signal, in the Properties pane, type rad into the white text box next to the Display Units property.

For a list of units supported by Simulink®, enter showunitslist into the MATLAB Command Window.

Now, the Simulation Data Inspector interprets the data for the alpha, rad signal as having units of rad. When you specify display units for a signal without units, the specified units also set the value for the stored units. Once a signal has units Simulink recognizes, you can convert the display units for the signal to supported compatible units using the Simulation Data Inspector. When you click the Display Units text box to modify the units, the Simulation Data Inspector provides a drop-down list of compatible units.

Change the alpha, rad signal display units to deg using the drop-down or by typing the new units into the Display Units field. When you change the units, the Simulation Data Inspector performs the conversion, and the plot updates to show the converted signal values.

You can also configure unit preferences in the Simulation Data Inspector to use units from a system of measurement or consistent units for a measurement type, such as length, for all logged and imported data. For more information, see Signal Display Units.

Note

You can convert the stored units for a signal using the convertUnits function. Unit conversion does not support undo and may result in loss of precision.

Modify Signal Data Type

You can modify the data type for a signal to analyze the effect on signal values or to create a signal to use as simulation input. Converting the data type in the Simulation Data Inspector does not affect any signal properties in the model. You can convert signal data types to all built-in data types. If you have a license for Fixed-Point Designer™, you can also convert to fixed-point data types. For a list of built-in data types, see Data Types Supported by Simulink.

Note

When you convert to a lower precision data type, you lose precision in the data that cannot be recovered. You can save a copy of the data in the Simulation Data Inspector before changing signal data types. For more information, see Save and Share Simulation Data Inspector Data and Views.

The data type for the alpha, rad signal is double. Suppose you want to convert the data type to single. First, select the alpha, rad signal. Then, expand the Properties pane and click the white text field next to the Data Type property. You can type single or select it from the drop-down of data types. The Simulation Data Inspector converts the data when you click outside the drop-down.

Because the single data type has less precision than the double data type, the Simulation Data Inspector returns a warning about irreversible precision loss. Click Continue. The plot shows no visible difference in the signal. If you saved the data for the original signal, you can compare the converted signal to analyze the effect of changing the data type. For more information on comparing data in the Simulation Data Inspector, see Compare Simulation Data.

Fixed-Point Conversions

If you have a license for Fixed-Point Designer, you can convert signal data types to fixed-point data types in the Simulation Data Inspector. Specify the data type in the Data Type property text box using the fixdt function.

Modify Signal Names

You can modify the names of signals in the Simulation Data Inspector. Changing the name of a signal in the Simulation Data Inspector does not affect signal names specified in the model. You can specify a new name from the work area, the Archive, or the Properties pane. To modify the signal name, click the signal name and type the new name. For example, change the name of the alpha, rad signal to alpha because the Units property now has the units information.

When you export data from the Simulation Data Inspector after modifying the name, the exported data uses the new name.

Related Topics