Main Content

Use Scenarios and Insert Signals in Signal Editor

Use Scenarios to Group and Organize Inputs

Signal Editor uses scenarios to group and organize sets of inputs to be saved to a MAT-file for a single simulation. To create signal data using existing data sets from existing scenarios, or create an empty scenario into which to add signals, use the Signal Editor Scenario menu.

Scenario dropdown menu containing Scenario and From Workspace

ActionOption

To create a scenario from the root inports of a model

Select Scenario > Scenario from Model. (Available only when accessing Signal Editor from the Root Inport Mapper.)

You can also use the signaleditor function with a model argument.

Note

When using this option, the resulting scenario contains signals with the data types and dimensions of the inport ports.

To create an empty scenario and create signals from scratch

Select Scenario > Scenario.

To import scenarios from MATLAB® workspace

Select Scenario > From Workspace.

After you have your scenario:

Link in Signal Data from Signal Builder Block and Simulink Design Verifier Environment

You can use Signals > Edit MAT-File to link in MAT-file data from these sources for editing.

  • Signal Builder blocks.

  • Simulink® Design Verifier™.

Link in Data from Signal Builder

You can link in and edit data exported from the Signal Builder block in a MAT-file or MATLAB. Use one of these methods to export the data:

  • Signal Builder block File > Export Data > To MAT-file option, then link in the MAT-file.

  • signalbuilder get function with data sets, then perform either of these steps:

    • Import the data sets in the workspace and save to a MAT-file

    • Save the data sets in the workspace to a MAT-file and import the MAT-file

For more information on exporting from a Signal Builder block, see Exporting Signal Group Data.

Link in Test Vectors from Simulink Design Verifier Environment

You can link in and edit Simulink Design Verifier test vectors. This workflow requires a Simulink Design Verifier license.

Before linking in, use the Simulink Design Verifier sldvsimdata (Simulink Design Verifier) function to convert a Simulink Design Verifier test structure to a set of Simulink.SimulationData.Dataset objects. This file contains a test vector structure sldvData. Save the output to a MAT-file and then import that file into Signal Editor.

Insert Signals

To insert signals into scenarios, select the scenario. Then, from the Insert section, select a signal.

The new signals appear in the Inputs section.

Inputs pane with Scenario, Signal, Signal1, Bus, and FunctionCall

You can also insert multiple signals of the same type. For more information, see Create Signals with the Same Properties.

To change the signal order in the hierarchy or change the name of a signal, see Change Signal Names and Hierarchy Orders.

To edit the properties of a signal:

Add Signals to Scenarios

This example describes how to create a scenario to be linked to from the Root Inport Mapper tool. You can then start the Signal Editor to manipulate and add signals to this scenario.

  1. In the MATLAB Command Window, create some data by typing:

    ts = timeseries([0;20],[0;10]); 
  2. In Simulink Editor, create a model that contains three Inport blocks, three Gain blocks, a Mux block, and a Scope block. Connect these blocks as shown:

    Resulting model

  3. Set the gain for the Gain blocks to 5, 10, and 15, respectively.

  4. Click one of the Inport blocks, then in the Simulink Editor toolstrip, click the Root Inport > Connect Inputs button.

    The Root Inport Mapper tool displays.

  5. In Root Inport Mapper Link section, select From Workspace.

  6. In the From Workspace window, select ts and click OK. In the Save As dialog, enter a name to store the MAT-file, then click OK.

  7. In the Edit section of the Root Inport Mapper, select Signals > Edit MAT-File.

  8. In the Selected Linked MAT-File window, select the new MAT-file and click OK.

    The Signal Editor displays with scenario whose name is the same as the MAT-file.

  9. Add a new scenario. Click Scenario.

  10. Add a signal, Signal, to the scenario. Right-click the scenario and select Insert > Signal.

    This action adds Signal with these default properties.

    Default Properties for Insertion dialog box containing tabs for Signals, Buses, Constant, Step, and Pulse. Signals properties contains data type, interpolation, unit, dimensions, signal type, and variable type.

    Alternatively, insert signals by clicking a signal type from the Insert section or using the Signal split button to author a signal using signal notations.

  11. Change the default properties of signals you want to add. In the Insert section, select Defaults. In the Default Properties for Insertion dialog box, change the data type to boolean, then right-click the scenario and select Insert > Signal.

    This action adds Signal1 with the data type boolean.

  12. To check that the data type is boolean, -double-click for Signal1.

See Also

Blocks

Tools

Related Topics