Documentation

Configure Data Properties by Using the Model Data Editor

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.

Note

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.

Configure Distant Data Items

The example model sldemo_fuelsys_dd represents the fueling system of a vehicle engine. The referenced model sldemo_fuelsys_dd_controller controls 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.

Explore Example Models

  1. Open sldemo_fuelsys_dd and the referenced model sldemo_fuelsys_dd_controller.

  2. Navigate to the airflow_calc subsystem.

    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.

  3. Navigate to the root of the model and into the fuel_calc subsystem.

  4. Navigate into the feedforward_fuel_rate subsystem.

    The Outport block named ff_fuel_rate passes feedforward information to the fuel rate control algorithm.

  5. Navigate back to the fuel_calc subsystem and into the switchable_compensation subsystem.

    The Inport block named ff_fuel_rate carries the feedforward information. You can stream the output of this Inport block.

Log Signals for Data Inspection

  1. Navigate to the root of the sldemo_fuelsys_dd_controller model.

  2. In the Model Data Editor, inspect the Signals tab.

  3. Set the Change view drop-down to Instrumentation.

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

  5. In the Filter Contents box, type ff_fuel_rate.

    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.

  6. Select the Log Data check box for the signal whose path is sldemo_fuelsys_dd_controller/fuel_calc/switchable_compensation.

    This instructs Simulink® to send the data for the logged signals to the Simulation Data Inspector.

  7. Filter the signals again using the text Pumping Constant.

    The table contains one row that corresponds to the output of the Pumping Constant block.

  8. Select the Log Data check box for the Pumping Constant signal.

  9. Simulate the system model, sldemo_fuelsys_dd. During the simulation, double-click a Manual Switch block, such as Engine Speed Selector, to disturb the fuel control system.

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

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

Select Multiple Data Items from Block Diagram

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.

  1. In the example model sldemo_househeat, open the Heater subsystem.

  2. Open the Model Data Editor and select the Signals tab.

    The Model Data Editor identifies all the signals in the subsystem.

  3. In the Model Data Editor, set the Change view drop-down list to Instrumentation.

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

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

  6. Simulate the model.

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

Interact with a Model That Uses Workspace Variables

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 Simulink.Parameter object that the model sldemo_fuelsys_dd_controller uses.

  1. Open the model.

    sldemo_fuelsys_dd_controller

  2. Open the Model Data Editor Parameters tab.

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

  4. In the model, navigate into the airflow_calc subsystem.

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

  6. In the model, click the lookup table block labeled Pumping Constant.

    The Model Data Editor shows that the block uses three workspace variables. The block acquires some breakpoint values from the Simulink.Parameter object SpeedVect.

Now, you can use the columns in the Model Data Editor to configure the properties of SpeedVect.

You can further interact with a variable to:

  • Configure other properties that the columns do not represent:

    1. In the model, open the Property Inspector (View > Property Inspector).

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

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

Find and Organize Data by Filtering, Sorting, and Grouping

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.

  1. In the example model, open the Model Data Editor and select the Parameters tab.

  2. Activate the Change scope button to display the contents of the subsystems.

  3. Click the Show/refresh additional information button to display rows that correspond to the dictionary entries.

  4. 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).

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

Inspect Individual Data Item

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 Design, Instrumentation, and Code views).

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

Navigate from Model Data Editor to Block Diagram

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.

Columns in the Data Table

Use this table to find more information about the purpose of the columns in the Model Data Editor.

Column NamePurpose and More Information
Source

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 TypeControl Signal Data Types
Min and MaxSignal Ranges
DimensionsSignal Dimensions
ComplexitySets the numeric complexity of the data item.
Sample TimeWhat Is Sample Time?
UnitUnit Specification in Simulink Models
Test PointTest Points
Log DataIterate Model Design with the Simulation Data Inspector
ResolveCorresponds 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.
Storage Class

Control Signals and States in Code by Applying Storage Classes (Simulink Coder)

To use a custom storage class from a package that you create, see Configure Data Interface by Using Model Data Editor (Embedded Coder).

Header File

Definition File

Get Function

Set Function

Struct Name

Sets custom attributes for custom storage classes, which you select with Storage Class. See Control Data Representation by Applying Custom Storage Classes (Embedded Coder).

SharedCorresponds to the Share across model instances parameter of the Data Store Memory block. See Data Store Memory.
Initial ValueSets the initial value of the state or data store. See Initializing Signal Values.
ValueSet Block Parameter Values
ArgumentConfigures a variable in a model workspace as a model argument. See Parameterize Instances of a Reusable Referenced Model.
Path

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.

Two Entries Per Cell in the Data Table

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 single, for 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 right side.

Model Data Editor Limitations

  • You cannot specify these attributes by using the Model Data Editor:

    • Any settings for block parameters other than the parameter value. However, you can click the Show/refresh additional information button and use the data table to configure MATLAB variables and Simulink.Parameter objects that you use to set block parameter values.

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

    • Design attributes for Simulink.LookupTable and 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.

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

Related Topics

Was this topic helpful?