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
format. You can access the Signal Editor in the following ways:
signalEditorfunction — 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
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
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.
Mouse, Keyboard, and Touchscreen Shortcuts
Pan and pinch
Click and draw
Select a point
Click , then click and select point or area
To select all areas, double-click
Pan and pinch
To select all areas, double-tap
Move a point
Click and drag
Tap and move
|Change data of a point|
|Continuously delete points on a line|
Three mouse clicks
|Expand along the x-axis|
|Expand along the y-axis|
|Type of Zoom or Pan||Button to Click|
Zoom in along the T and Y axes.
Zoom in along the time axis. After selecting the icon, on the graph, drag the mouse to select an area to enlarge.
Zoom in along the data value axis. After selecting the icon, on the graph, drag the mouse to select an area to enlarge.
Zoom only in x while zooming in xy.
|Zoom in xy while pressing Ctrl|
Zoom only in y while zooming in xy.
|Zoom in xy while pressing Shift|
Zoom out from the graph.
Fit the plot to the graph. After selecting the icon, click the graph to enlarge the plot to fill the graph.
Pan the graph up, down, left, or right. Select the icon. On the graph, hold the left mouse button and move the mouse to the area of the graph that you want to view.
Change Signal Names and Hierarchy Orders
In the Scenarios and Signals section, you can change signal names and hierarchy order, create duplicates of signals, and delete signals. Simulink ignores leading and trailing spaces in signal names.
To change a signal name, double-click the name and change it.
To change the unit or interpolation of a signal, click the plus sign and click the Unit or Interpolation check boxes.
The pane updates with Unit and Interpolation columns.
In the Unit column, enter an appropriate unit expression. For a suggested list of unit expressions, see allowed units.
In the Interpolation column, from the drop-down list, select
zero order hold.
Interpolation affects only the plotting of signals in the Signal Editor user interface.
To change the order of a signal in the hierarchy, drag and drop it. For example, you can drag and drop signals into a bus.
Alternatively, use the Move Up and Move Down buttons in the Adjust section.
To copy a signal and paste it under the original, right-click it and select Duplicate Signal.
Alternatively, use the Duplicate button in the Adjust section. You can also adjust the default properties of the signal you duplicate. For more information, see Create Signals with the Same Properties.
To copy a signal and paste it elsewhere in hierarchy, select Copy and then Paste.
Create Signals with the Same Properties
To create signals of the same predefined type, use the Duplicate button in the Adjust section. To change the predefined signal type, click the Defaults icon, . A Default Properties for Insertion dialog box displays.
Data type — From the drop-down list, select the signal data type.
Enumeration — When you select the
Enumdata type, this parameter displays. Enter the class name of your enumeration.
If you define an enumeration class that contains the same integer value multiple times, for example:
classdef(Enumeration) hEnumColors_duplicateValues < Simulink.IntEnumType enumeration Red(118) Yellow(-14) Blue(90) Green(87) White(-14) Black(198) Brown(90) Pink(118) Purple(90) end methods (Static = true) function retVal = getDefaultValue() retVal = hEnumColors_duplicateValues.Blue; end end end
The Signal Editor treats the first enumeration value (
Red (118)) as the canonical value and equates all subsequent instances of the same underlying integer
118to the enumerated name
Red. In other words,
Interpolation — From the drop-down list, select
zero order hold.
Unit — Enter an appropriate unit expression. For a suggested list of unit expressions, see Allowed Units.
Dimensions — Enter the number of dimensions for the signal.
Signal type — From the list, select
Variable type — From the drop-down list, select
Valueproperty is of data type
Bus object — From the drop-down list, select the bus object for which to define the dimensions. If you leave the Bus object parameter at the default
<object name>, Signal Editor adds empty buses.
Dimensions — Enter the number of dimensions for the bus object.
Value — Enter constant value to output.
Time — Enter sample time.
Initial value — Enter output value before step.
Final value — Enter output value after step.
Start time — Enter time when step occurs.
Step time — Enter time when step occurs.
Step final time — Enter final step time.
Initial value — Enter initial default value of signal.
Value at trigger — Enter value of signal at pulse trigger.
Pulse duration — Enter length of time of pulse.
Step time — Enter time when step occurs.
Trigger time — Enter time when pulse trigger occurs.
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
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.
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:
In the Signal Editor, select Signal > Author Signal.
Enter signal data with two columns and time from 1 to 10:
Click Insert Signal.
The hierarchy updates with the new signal data.
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.
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.
You can edit the data directly in the table.
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.
Work with Data in Signals
This example describes how to add and delete data to the signals in the linked scenario. To create a model and data to work with, see Add Signals to Scenarios.
In the Signal Editor, in the Scenarios and Signals section, click the plot check box for the signal
Add some data to the signal
Click the add row icon and add some signals. To add a signal row between other signals, click the signal before and click the add row icon.
When done, click Apply. Clicking Apply updates the plot.
Remove the time 20 line from the signal. Select
20and click .
Alternatively, if you want to replace all the signal data for
tswith a signal defined with signal notations, click the replace button and use the Author and Replace Signal Data dialog box to define new data.
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.
In the Signal Editor tab, select Signal > Draw Signal.
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.
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
In the Signal Properties section, in Name, change the signal name to
Rampand press Enter.
To add the signal to the Signal Editor, in the Insert section, click .
To return to the main Signal Editor window and check that the signal has been added, click .
To observe the drawn signal data In Signal Editor, click the Plot/Edit check box for the
Rampsignal name in the hierarchy.
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.
- Create Freehand Signal Data Using Mouse or Multi-Touch Gestures
- Map Root Inport Signal Data
- View and Inspect Signal Data
- Import Signal Data for Root Inport Mapping
- Exporting Signal Group Data
- Map Signal Data to Root Input Ports
- Root Inport Mapping Scenarios
- Create Signal Data for Root Inport Mapping
- Create Custom File Type for Import to Signal Editor