Guy and Seth on Simulink

October 8th, 2010

Model Explorer for Data Management and more

Parasar KodatiBy Parasar Kodati

Working with models can involve multiple interfaces to configure and run a simulation. You may need to: navigate through the various levels of model hierarchy in the model editor; use the Configuration Parameters interface to select things like the solver and step size; and use the MATLAB workspace for loading data and specifying data characteristics. Today I will show how you can manage a great deal of model information using a single interface.

With Model Explorer, you can view model hierarchy and the associated data at different levels of scope in the same interface. You can even mass edit data attributes and perform tasks related to requirements linking. In R2010b, Model Explorer has new features to find data dependency of a model and its components, import and export data from files as well as ability to organize and filter entity views. Let us look at some of the tasks you do regularly and see how you can do these with less effort.

1. Find the variables used by a model and save them to a file

To find the data dependency of a model or subsystem simply use the context menu and select Find Referenced variables option. Once you have the variables select them and use the “Export” option from the context menu to save them to a MAT-file or an editable MATLAB file.

2. Find the different data types of constant block outputs

Navigate to the subsystem of interest and then group the entities by OutputDatatypeStr property. In the Filter Contents checkbox type Blocktype:Constant to filter the content to constant blocks. This shows all the constant blocks in the subsystem grouped by the data type of their output. Collapse the groups to look at the different datatypes of the variables and expand them back to inspect individual items.

3. Apply the set of configuration parameters that you used for a model in an earlier project to the model in your current project.

Navigate to the old model in Model Explorer, click on the “Export Active Configuration Set” from the context menu and save it to a MAT file or an editable MATLAB file. Select the new model and click on the Import option from the context menu. In the Import dialog select the file with old configuration parameters to import them to the new to the new model.

Now it’s your turn!

How often do you use Model Explorer and what do you use it for? Leave a comment here and tell us how you manage your data.

One Response to “Model Explorer for Data Management and more”

  1. KE replied on :

    Can #3 be done from the Matlab command line? I am scripting my parameter study.

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


MathWorks
Guy Rouleau and Seth Popinchalk are Application Engineers for MathWorks. They write here about Simulink and other MathWorks tools used in Model-Based Design.

These postings are the author's and don't necessarily represent the opinions of The MathWorks.