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.

  • Add the same signals to multiple scenarios simultaneously.

  • Edit signal properties for multiple signals simultaneously.

  • Use signal notations to create more complicated signals using MATLAB® expressions. You can use the Author Signal 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:

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:

  • In the Properties for Insertion dialog box, available by clicking Defaults in the Signals Editor tab, change the Dimensions property. For a multidimensional blank signal, enter a dimension greater than 1. Then, select Insert > Signal to insert a new basic signal. Observe that the new signal has multiple dimensions represented.

    Signal1 with 3 multidimensional signals.

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

When you double-click show/hide for the signal, the tabular data area displays the signal with columns for each dimension. You can edit the data individually in the tabular data area, cut, copy, or replace data with Excel spreadsheets, 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 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 box 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 double-click show/hide for the signal. 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, click Fit to view 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

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

    Tip

    Selecting a point in the plot highlights the associated data in the table. Vice versa, selecting a data point in the table highlights the associated point in the plot.

    Deleting a point in the plot deletes the associated data in the table. Vice versa, deleting a data point in the table deletes the associated point in the plot.

  6. To synchronize all the signals in open plots by time (x-axis), select Synchronize X-limits in the Synchronize.SignalX Axes Properties pane. Use this setting to also synchronize zooming, panning, and fit-to-plot.

Change x- and y-axes Limits

Change plot x- and y-axes limits in the SignalX.Scenario Axes Properties panes. When you change the limit, the plot adjusts your view.

For example, look at this plot and SignalX.Scenario Axes Properties pane. The rightmost limit of the x-axis is 11.037.

Plot of Signal.Scenario Axes Properties before a change. The original rightmost limit of the x-axis limit is 11.037.

The data in this plot is the same, but the plot has a rightmost x-axis limit of 9.

Plot of Signal.Scenario Axes Properties after a change. The adjusted rightmost limit of the x-axis limit is 9.

Change Signal Data Output Format Preferences

By default, the Signal Editor tool displays signal data in its data pane as double, with a format that displays integers as whole numbers (auto).

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

Floating-point and fixed-point data types display with their least significant digits.

To change display time and signal data formats in the Signal Editor tool, use the Display Format pane. You can change the display format for time and data. The Signal Editor tool preserves the display format settings across Signal Editor sessions. For example, to change the time and format display to use a formatting operator, for Display Format Time and Floating point, select %5.3g. You can change the formatting operator as necessary. The Signal Editor tool remembers the last five unique formatting operators.

Hierarchy and plot of time = [1:10] and data = [(1:10)' (1:10)'] and display format %5.3g

The effect of the associated display format fields depends on the data type. For example, if the data type is double, setting Fixed point has no effect.

Hierarchy and plot of time = [1:10] and data = [(1:10)' (1:10)'] and display format %5.3g, data type double

However, if the data type of this data is changed to a fixed-point value, then the Fixed point takes effect.

Hierarchy and plot of time = [1:10] and data = [(1:10)' (1:10)'] and display format %5.3g, data type fixed-point

For more information on display formats, see Format Output and Formatting Text.

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 Insert > Signal.

  2. Expand the new signal and double-click show/hide for the signal. Observe the associated plots and the tabular data for the signal.

  3. In the Edit tab, to line up the signal data values along horizontal and vertical lines, select Align > Snap X to Grid and Align > Snap Y to Grid.

    Move and zoom also honor snap to grid settings.

  4. In the canvas, use Erase to erase the second point.

  5. 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

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

    Signal properties shows name Ramp name.

Save and Send Changes to the Root Inport Mapper Tool

When you are done adding and modifying signals and scenarios, use the Save button to save the changes to a MAT-file. The Signal Editor can also send 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