Displaying parameter values in blocks

When browsing Simulink models in the itemis Model Viewer, it can be helpful to see the values of parameters directly in the model. However, Matlab maintains parameter values in the Matlab workspace, not in the model. Thus, itemis Model Viewer cannot access them directly when opening the model file.

However, itemis Model Viewer implements a solution to circumvent this obstacle. Here’s an outline of what you can do:

  • Maintain parameter values in Matlab as usual.
  • Execute a Matlab script to export all parameters and values to a separate file ( .ymvd file).
  • When itemis Model Viewer opens the model file, it also opens that .ymvd file and displays the parameter values.

The subsequent sections explain how to setup and run the export script and make use of parameter values in blocks.

Currently, this feature is supported for constant blocks only.

Installing the export script

The export script that extracts parameters and their values from the Matlab workspace and exports them to a .ymvd file is bundled with itemis Model Viewer. You will find it as a zip-compressed archive file YAKINDU_Export.zip in the scripts subfolder of the itemis Model Viewer installation directory.

  • Unzip that file to a directory of your choice.
  • Add the script directory to the Matlab search path. This is required to be able to execute the script from the Matlab command window.

Initializing the Matlab workspace

Open Matlab Simulink and initialize your Simulink workspace completely. That is, execute all required Matlab Simulink scripts, especially those that initialize any parameter values. The parameter values must be set before the export script can be run.

Please ensure that Simulink can find all needed libraries. If any libraries are missing, please include them in the Matlab search path.

Executing the export script

Now that all parameter values are set, you can run the script to export them. Go to Matlab Simulink, enter the following into the command window, and hit [Return].


Entering the export command on the Matlab command-line

Entering the export command on the Matlab command-line

The export command executes, logs what it does to the command window, and creates a file besides the model file. That file comes with the same basename as the model file, but with a .ymvd filename extension.

The export script creates an ".ymvd" file alongside the model file.

The export script creates an .ymvd file alongside the model file.

If you specify just the model name in the export command, Simulink expects the model to reside in the Matlab search path. However, your model file might reside somewhere else. In this case, please also specify the path to the model. That path is relative to the current folder.


Displaying parameter values in itemis Model Viewer

Now open the Simulink model in itemis Model Viewer. The tool will notice the .ymvd file besides your model file, read it, and display the parameters.

Parameter names are shown inside the block, and – in parenthesis – their associated values. The label below the block displays the block’s name. Parameter names and values can also be seen in the properties view.

Constant blocks with parameter values displayed in itemis Model Viewer

Constant blocks with parameter values displayed in itemis Model Viewer