Main Content

Create and Edit Signal Data

Use the Signal Editor to create and edit input signals that you can organize for multiple simulations. You can then save the signal data to a MAT-file for simulation or to map to root-level ports. By default, Signal Editor creates signal data in timeseries format. You can access the Signal Editor in the following ways:

  • signalEditor function — Signal Editor starts from the command line.

  • From the Root Inport Mapper — To create a MAT-file for your new signal data, select Signals > New MAT-File. To link in an existing signal data file from an existing scenario and edit the signals in that file, use the Signals > Edit MAT-File.

  • From the Signal Editor block

Signal Editor works only with MAT-files.

You can manipulate signals in these ways:

  • Create and edit multiple signals in multiple data sets. By default, Signal Editor creates timeseries format data.

  • Use signal notations to create more complicated signals using MATLAB® expressions. You can use the Author and Insert dialog box or manually enter simple MATLAB expressions in the tabular area.

  • Use existing scenarios to get existing data sets for which you can edit and create signals.

  • Create and edit multidimensional signals.

  • Edit signals imported as registered custom file types. For more information, see Import Custom File Type.

While editing signal data:

  • Use tabular editing or MATLAB to modify signal data.

  • Use mouse or multi-touch editing to graphically modify signal data.

  • Modify signal properties such as name, interpolation, and unit properties.

  • Drag and drop signals to change signal hierarchies for buses and data sets.

  • Use signal notations and variables to replace signal data.

Alternatively, you can import data from external sources and edit them in Signal Editor. For more information, see Link in Signal Data from Signal Builder Block and Simulink Design Verifier Environment.

To graphically create and edit signal data, see Create Freehand Signal Data Using Mouse or Multi-Touch Gestures.

Differences Between the Root Inport Mapper Signal Editor and Other Signal Editors

Generally, the Signal Editor user interface is the same regardless of how you access it. Here are the differences in the Root Inport Mapper Signal Editor:

  • FILE section Save and Sync and SAVE commands save and synchronize to the Root Inport Mapper.

  • Insert section Scenario command always has the option, Scenario from Model.

If you start the function with a model name, the signalEditor function Signal Editor user interface shows the option Scenario from Model in the Insert section.

Table Editing Data Support

The Signal Editor user interface supports all signal data types that Simulink® supports and that are editable.

Add and Edit Multidimensional Signals

To add multidimensional signals, use either of these options:

  • Change the Dimensions property in the Default Properties for Insertion dialog box, and then use Insert > Blank Signal to insert a new blank signal. For a multidimensional blank signal, enter a dimension greater than 1.

  • Enter multidimensional signal data in the Author and Insert dialog box Data parameter, such as [(1:10)' (1:10)'].

When you click the Plot/Edit check box for the signal, the tabular area displays the signal with columns for each dimension. You can edit the data individually in the tabular area, or click the replace button to replace the signal with a MATLAB expression. Use the Author and Replace Signal Data dialog box as though you are inserting a new expression with the Author and Insert dialog box. For more information, see Create Signals with MATLAB Expressions and Variables.

Tip

When replacing a signal, the signal dimension and complexity of the new signal must be the same as the signal being replaced.

For example, to create signal data with two columns and time from 1 to 10:

  1. In the Signal Editor, select Insert > Author Signal.

  2. Enter signal data with two columns and time from 1 to 10:

    • Time[1:10]

    • Data[(1:10)' (1:10)']

    Author and Insert dialog window with time = [1:10] and data = [(1:10)' (1:10)'

  3. Click Insert Signal.

    The hierarchy updates with the new signal data.

  4. Expand the new signal and click the Plot/Edit check boxes for the new signal data. Observe the associated plots and the tabular data for the signal.

    Hierarchy and plot of time = [1:10] and data = [(1:10)' (1:10)']

    Tip

    If the data does not plot as expected, use the Fit to window button in the Zoom & Pan section. For multidimensional signals, also make sure that you have the right plot selected for the column data you are editing.

  5. You can edit the data directly in the table.

    Hierarchy and plot with time = 4, data(;,1)=10, data(;,2)=4

    Or you can replace data completely with a new expression by clicking the Replace button and entering a new time range and data in the Author and Replace Signal Data dialog box.

Draw a Ramp Using Snap to Grid for Accuracy

This example describes how to create a ramp signal by selecting some points in the canvas.

  1. In the Signal Editor tab, select Signal > Draw Signal.

  2. To line up the signal data values along horizontal and vertical lines, select Snap X to Grid and Snap Y to Grid.

    Move and zoom also honor snap to grid settings.

  3. In the canvas, add three points:

    • Two points horizontal to each other

    • One point set to the right at an angle to the other signals

  4. In the Signal Properties section, in Name, change the signal name to Ramp and press Enter.

    Signal properties shows name Ramp name.

  5. To add the signal to the Signal Editor, in the Insert section, click .

  6. To return to the main Signal Editor window and check that the signal has been added, click .

  7. To observe the drawn signal data In Signal Editor, click the Plot/Edit check box for the Ramp signal name in the hierarchy.

    Hierarchy and plot for ramp.

Save and Send Changes to the Root Inport Mapper Tool

When you are done adding and modifying signals and scenarios, use the Save and Sync button to save the changes to a MAT-file. The Signal Editor also sends the data to the Root Inport Mapper Tool:

  • If the Root Inport Mapper tool has the scenario loaded, the Root Inport Mapper tool updates with the new data.

  • If the Root Inport Mapper tool has the scenarios mapped and your changes affect the mapping, the Root Inport Mapper tool unmaps the scenario.

See Also

Blocks

Tools

Functions

Related Topics