Models contain data items such as signals, block parameters (for example, the Gain parameter of a Gain block), and data stores. The Model Data Editor enables you to inspect and edit data items in a list that you can sort, group, and filter. You can then configure properties and parameters, such as data types and dimensions, without having to locate the items in the block diagram.
While creating and debugging a model, you can configure multiple data items at once by selecting the corresponding signals and blocks in the block diagram. Work with the selected items in the Model Data Editor instead of opening individual dialog boxes. Use this technique to more quickly view and compare properties of multiple signals that are close to each other in the diagram, for example, in a subsystem.
Use the Model Data Editor to configure:
Instrumentation for signals and data stores, which means you want to view and collect the simulation values. For example, you can log signals to compare data in the Simulation Data Inspector.
Design attributes such as data type, minimum and maximum value, and physical units. For example, you use these attributes to:
Specify the values of numeric block parameters.
Control the interaction (interface) between components through Inport and Outport blocks and data stores (see Configure Data Interface for Component).
Specify the dimensions of nonscalar signals in a model.
Storage classes, which control the representation of the data in the code (for example, C) that you generate from the model.
To open the Model Data Editor in a model, select View > Model Data Editor or press Ctrl+Shift+E.
The Model Data Editor does not show information about data items in referenced models (which you reference with Model blocks). To work with data items in a referenced model, open the Model Data Editor in that model.
The example model
the fueling system of a vehicle engine. The referenced model
the rate of fuel flow to the engine. In this example, use the Model
Data Editor to log signals in different subsystems and referenced
models so you can inspect their data using the Simulation Data Inspector.
sldemo_fuelsys_dd and the
Navigate to the
The Pumping Constant block contains a lookup table that describes the performance of a fuel pump. You can stream the output of this block to the Simulation Data Inspector.
Navigate to the root of the model and into the
Navigate into the
The Outport block named
feedforward information to the fuel rate control algorithm.
Navigate back to the
and into the
The Inport block named
the feedforward information. You can stream the output of this Inport block.
Navigate to the root of the
In the Model Data Editor, inspect the Signals tab.
Set the Change view drop-down to
Activate the Change scope button to display the contents of the subsystems.
The Model Data Editor identifies all the signals in the model. The Path column appears.
In the Filter Contents box, type
The Model Data Editor updates the list of signals to include
only those named
ff_fuel_rate. You can click the
link in the Path column to view where the signal
resides within the model.
Select the Log Data check box
for the signal whose path is
This instructs Simulink® to send the data for the logged signals to the Simulation Data Inspector.
Filter the signals again using the text
The table contains one row that corresponds to the output of the Pumping Constant block.
Select the Log Data check box
Pumping Constant signal.
Simulate the system model,
During the simulation, double-click a Manual Switch block,
Engine Speed Selector, to disturb the fuel
When the simulation finishes, the Simulation Data Inspector button is highlighted. This indicates that there is data to inspect and compare. Click the Simulation Data Inspector button.
In the left pane, expand the Run node that corresponds to the simulation run and select the check boxes for the signals whose data you want to inspect and compare.
The Simulation Data Inspector presents the values for the selected signals on the same graph.
In the example model
sldemo_househeat, use the Model Data Editor to log the
signals in the
Heater subsystem for inspection using the
Simulation Data Inspector.
In the example model
Open the Model Data Editor and select the Signals tab.
The Model Data Editor identifies all the signals in the subsystem.
In the Model Data Editor, set the Change view
drop-down list to
Using the Simulink Editor, select all the signals in the subsystem. Optionally, do not select the output of the Constant block because the signal value does not change during the simulation.
In response, the Model Data Editor highlights the rows that correspond to the signals you selected.
In the Model Data Editor, for any of the signals, click the check box in the Log Data column.
The Model Data Editor selects the check box for all of the selected signals.
Simulate the model.
Open the Simulation Data Inspector and, in the leftmost pane, expand the Run node that corresponds to the simulation run. Select the check boxes for the signals whose values you want to inspect and compare.
When you use workspace variables (such as numeric MATLAB® variables and
Simulink.AliasType objects) to share
settings between data items, you can interact with those variables through the Model
Data Editor. You do not need to work outside the Editor to configure the data items.
In the Editor, click the Show/refresh additional information
button , which finds variables that the model uses by
updating the block diagram.
This example shows how to work with objects that a model uses to set block
parameter values. You modify the value of a
object that the model
Open the model.
Open the Model Data Editor Parameters tab.
In the Model Data Editor, click the Show/refresh additional information button.
The data table now contains rows that correspond to variables and objects that the model uses.
In the model, navigate into the
In the Model Data Editor, next to the Filter contents box, select the Filter using selection button.
With this button selected, when you select a block or signal in the block diagram, the data table shows only the data items and workspace variables that are relevant to that block or signal.
In the model, click the lookup table block labeled
The Model Data Editor shows that the block uses three workspace
variables. The block acquires some breakpoint values from the
Now, you can use the columns in the Model Data Editor to configure the properties
You can further interact with a variable to:
Configure other properties that the columns do not represent:
In the model, open the Property Inspector (View > Property Inspector).
In the Model Data Editor, select the row that corresponds to the target variable or object. If the Property Inspector does not respond, select a different row and then select the target row again.
Use the Property Inspector to configure the target properties.
Move the variable between workspaces and data dictionaries and configure the variable alongside other variables. Use the Model Explorer. To open the Model Explorer, in the Model Data Editor data table, double-click the icon in the leftmost column. For more information about using the Model Explorer, see Edit and Manage Workspace Variables by Using Model Explorer.
Rename a variable everywhere it is used by blocks in Simulink models. In the Model Data Editor, right-click the variable and select Rename All.
Find blocks that use a specific variable. In the Model Data Editor, right-click the variable and select Find Where Used.
In the example model
sldemo_fuelsys_dd_controller, workspace variables and
parameter objects set the values of block parameters. The variables and objects
reside in a data dictionary. Use the Model Data Editor to display these dictionary
entries together in a group.
In the example model, open the Model Data Editor and select the Parameters tab.
Activate the Change scope button to display the contents of the subsystems.
Click the Show/refresh additional information button to display rows that correspond to the dictionary entries.
Right-click the Source column header and select Group by This Column.
The Model Data Editor groups the list by block or workspace (including a group for the dictionary entries).
Find the group labeled Source: Dictionary. Now, you can use the Model Data Editor to inspect and modify the attributes of the variables and objects in the dictionary.
You can filter the data table through a text search. Use the Filter contents box.
Alternatively, you can filter based on the blocks or signals that you select in the model. Next to the Filter contents box, select the Filter using selection button. Then, as you click blocks and signals in the model, the Model Data Editor shows you only the rows that are relevant to that block or signal. If you lasso multiple blocks or signals, the Model Data Editor shows only the rows that are relevant to those model elements.
To focus on an individual data item, use one of these techniques:
In the Model Data Editor, next to the Filter contents box, select the Filter using selection button. Then, in the model, click the block or signal that corresponds to the data item.
Use this technique to configure the item by using the columns in the data table.
In the model, open the Property Inspector (View > Property Inspector). Then, in the data table, click the target row. The Property Inspector shows the properties of the data item. If the Property Inspector does not respond when you click the target row, click a different row and then click the target row again.
Use this technique to inspect all of the properties that the Model
Data Editor can access at once (in other words, the union of the columns
available in the
In the model, open the Property Inspector. Then, in the data table, for the target row, double-click the cell in the leftmost column (the icon). In the model, select the highlighted block or signal.
Use this technique to inspect all properties, including those that the Model Data Editor cannot access.
To navigate from a data item in the Model Data Editor to the block in the diagram that owns the data item, double-click the icon in the left-most column. The Simulink Editor then focuses on the relevant block. Use this technique to navigate to blocks when you select Change scope to view the contents of subsystems below the current system.
Use this table to find more information about the purpose of the columns in the Model Data Editor.
|Column Name||Purpose and More Information|
Shows the name of the block that defines the data item. For signals, also shows the number of the block port that generates the signal.
For workspace variables, shows the name of the workspace or data dictionary that contains the variable.
|Signal Name or Name||
Sets the name of the signal, state, or data store. For information about naming signals, see Signal Names and Labels.
For parameters, displays the programmatic name of each parameter.
For workspace variables, sets the name of the variable.
|Data Type||Control Signal Data Types and Control Block Parameter Data Types|
|Min and Max||Signal Ranges and Specify Minimum and Maximum Values for Block Parameters|
|Complexity||Sets the numeric complexity of the data item.|
|Sample Time||What Is Sample Time?|
|Unit||Unit Specification in Simulink Models|
|Test Point||Test Points|
|Log Data||Iterate Model Design Using the Simulation Data Inspector|
|Resolve||Corresponds to the Signal name must resolve to Simulink signal object check box in the Signal Properties dialog box and similar check boxes in block dialog boxes for states and data stores. See Use Signal Objects.|
To apply a custom storage class from a package that you create, see Apply Custom Storage Class from Specific Package to Signal, State, or Data Store Memory Block Using the Model Data Editor (Embedded Coder).
Sets custom attributes for custom storage classes, which you select with Storage Class. See Apply Custom Storage Classes to Individual Signal, State, and Parameter Data Elements (Embedded Coder).
|Shared||Corresponds to the Share across model instances parameter of the Data Store Memory block. See Data Store Memory.|
|Initial Value||Sets the initial value of the state or data store. See Initializing Signal Values.|
|Value||Set Block Parameter Values|
|Argument||Configures a variable in a model workspace as a model argument. See Parameterize Instances of a Reusable Referenced Model.|
Shows the location of the block in the model and provides a link to the block in the Simulink Editor. Visible when you click the Change Scope button.
When a cell contains two entries (for instance, in the Data Type column), the entry on the right side of the cell indicates compiled information. The compiled information shows you the value that the data item uses for simulation.
For example, the default data type setting for most signals in a model is
Inherit: Inherit via internal rule. With this
setting, after you update the block diagram, Simulink chooses a specific data type, such as
the signal to use for simulation. In the Model Data Editor, the cell in the
Data Type column shows
Inherit: Inherit via
internal rule on the left side and
single on the
You cannot access these attributes by using the Model Data Editor:
Any settings for tunable mask parameters other than the parameter value. Some built-in blocks are masked and have tunable mask parameters.
Any settings for nontunable mask parameters. Some built-in blocks are masked and have nontunable mask parameters.
Any settings for parameters of Simscape™ blocks.
Any settings for data items in referenced models. Instead, open the Model Data Editor in the referenced models.
Any settings for variables that are not defined in the base workspace, a model workspace, or a data dictionary. For example, you cannot access the attributes of variables created by mask initialization code.
Design attributes for
Simulink.Breakpoint objects. However,
you can open the Property Inspector, click the row that
corresponds to the object, and use the Property Inspector to
configure the object properties.
Alternatively, in the Model Data Editor, in the leftmost column, double-click the icon to open the Model Explorer, which you can use the configure the object properties.
On the Parameters tab, the data type, minimum value, and maximum value of a Constant block. Use the Signals tab instead.
For some settings that you cannot access with the Model Data Editor, you can use the Property Inspector instead (see Block Parameters and Properties in Simulink). Open the Inspector and select the target data item in the model, not in the Model Data Editor. For mask parameters, use the mask dialog box or the Mask Editor as described in Masking Fundamentals.
The Model Data Editor does not show Stateflow® data. However, the Model Data Editor shows the data for Simulink Functions that you define inside Stateflow charts.
To manage Stateflow data, events, and messages in a chart, see Manage Stateflow Data, Events, and Messages in the Symbols Window (Stateflow).
When using the Model Data Editor, if you specify a storage class for a signal and do not provide a signal name, the software generates a signal name. The generated name is derived from the block that generates the signal. If a block has non-ASCII values as part of its name or any invalid C variable name, only the ASCII values in the block names generate a name for the signal. If the two ASCII block names are not unique, this issue leads to a conflict in signal names during code generation.
On the Parameters tab, these variables are not available:
Variables used by non-tunable block parameters. For
example, the minimum and maximum parameters on a
Gain block or the
time on a Constant
Variant control variables
Variables used for symbolic dimensions