Modify Signal Properties in the Simulation Data Inspector

You can modify signal units, data type, and names in the Simulation Data Inspector. When you modify the units and data type metadata for a signal, the Simulation Data Inspector converts the signal values. Changes 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 choose 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

You can specify and modify signal units in the Simulation Data Inspector. 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. Select the alpha, rad signal in the Inspect pane.

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

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

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

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

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

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 has the units information, now.

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

Related Topics