Model variable search result object
Model variable search result object for a variable used in a Simulink® model or subsystem.
slreportgen.finder.ModelVariableResult class is a
For information on class attributes, see Class Attributes.
You do not create an
next methods create an
slreportgen.finder.ModelVariableResult object for each variable that is
Simulink.VariableUsage object for the
variable represented by this result. This property is read-only.
Name— Name of variable
Name of the variable represented by this result, specified as a character vector. This property is read-only.
Source— Source of variable definition
Source of the variable definition, specified as a character vector. This property is read-only. This table shows example values.
|MATLAB® base workspace|
|Model workspace for |
|Mask workspace for a masked block|
The data dictionary
SourceType— Type of defining workspace
Type of the workspace that defines the variable, specified as one of these character vectors:
This property is read-only.
Users— Blocks that use the variable
Blocks that use the variable, specified as a cell array of character vectors. This property is read-only.
ModelBlockPath— Path of Model block that set the variable value
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
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.
Tag— Additional information
Additional information to save with this result. You can set it to any type of value.
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 = slreportgen.report.Report("MyReport","pdf"); % Create a Chapter chapter = mlreportgen.report.Chapter(); chapter.Title = "Model Variable Reporter Example"; % Load the model model_name = "slrgex_sf_car"; load_system(model_name); % 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,reporter); end % Add chapter to the report add(rpt,chapter); % Close the report and open the viewer close(rpt); rptview(rpt);