Main Content

slreportgen.finder.ModelVariableResult class

Package: slreportgen.finder
Superclasses: mlreportgen.finder.Result

Model variable search result object

Since R2019b


Model variable search result object for a variable used in a Simulink® model or subsystem.

The slreportgen.finder.ModelVariableResult class is a handle class.

Class Attributes


For information on class attributes, see Class Attributes.


You do not create an slreportgen.finder.ModelVariableResult object explicitly. The slreportgen.finder.ModelVariableFinder find or next methods create an slreportgen.finder.ModelVariableResult object for each variable that is found.


expand all

Simulink.VariableUsage object for the variable represented by this result. This property is read-only.

Name of the variable represented by this result, specified as a character vector. This property is read-only.

Source of the variable definition, specified as a character vector. This property is read-only. This table shows example values.

'base workspace'MATLAB® base workspace
'MyModel'Model workspace for MyModel
'MyModel/Mask1' Mask workspace for a masked block

The data dictionary my_data_dictionary.sldd.

Type of the workspace that defines the variable, specified as one of these character vectors:

  • 'base workspace'

  • 'model workspace'

  • 'mask workspace'

  • 'data dictionary'

This property is read-only.

Blocks that use the variable, specified as a cell array of character vectors. This property is read-only.

Path of the Model block that set the variable value, specified as a character vector. This property is read-only.

Suppose that a referenced model uses a model argument to set a block parameter value. If a model has multiple instances of the referenced model, the model variable finder returns multiple instances of the variable that is associated with the model argument. The ModelBlockPath property uniquely identifies the instance of the variable by providing the path to the Model block that set its value. If a variable is not associated with a model argument in a referenced model, the ModelBlockPath is empty. For more information about referenced models and instance-specific parameters, see Parameterize Instances of a Reusable Referenced Model.

Additional information to save with this result. You can set it to any type of value.


expand all


collapse all

Customize the formatting of model variables in a report by iterating through the search results and setting properties of the model variable reporter for each result.

% Create a Report
rpt ="MyReport","pdf");

% Create a Chapter
chapter =;
chapter.Title = "Model Variable Reporter Example";

% Load the model
model_name = "slrgex_sf_car";

% Find the variables in the model
finder = slreportgen.finder.ModelVariableFinder(model_name);

while hasNext(finder)
    result = next(finder);
    % Get the ModelVariable reporter for the result
    % Customize the formatting of numbers
    reporter = getReporter(result);
    reporter.NumericFormat = "%.4f";
    % Add the reporter to the chapter
% Add chapter to the report

% Close the report and open the viewer

Version History

Introduced in R2019b