slreportgen.finder.ModelVariableResult Class
Namespace: slreportgen.finder
Superclasses: mlreportgen.finder.Result
Model variable search result object
Description
Model variable search result object for a variable used in a Simulink® model or subsystem.
The slreportgen.finder.ModelVariableResult
class is a handle
class.
Creation
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.
Properties
Public Properties
Tag
— Additional user-defined information
[] (default) | string scalar | character vector | object | ...
Additional user-defined information to add to the result, specified as any value.
Attributes:
NonCopyable | true |
Protected Properties
Object
— Simulink.VariableUsage
object
Simulink.VariableUsage
object
Simulink.VariableUsage
object for the
variable represented by this result.
Attributes:
SetAccess | protected |
Name
— Name of variable
string scalar
Name of the variable represented by this result, specified as a string scalar.
Attributes:
SetAccess | protected |
Source
— Source of variable definition
string scalar
Source of the variable definition, specified as a string scalar. This table shows example values.
Value | Description |
---|---|
"base workspace" | MATLAB® base workspace. |
"MyModel" | Model workspace for MyModel . |
"MyModel/Mask1" | Mask workspace for a masked block. |
"my_data_dictionary.sldd" | The data dictionary my_data_dictionary.sldd . |
Attributes:
SetAccess | protected |
Data Types: string
SourceType
— Type of defining workspace
string scalar
Type of the workspace that defines the variable, specified as one of these string scalars:
"base workspace"
"model workspace"
"mask workspace"
"data dictionary"
Attributes:
SetAccess | protected |
Data Types: string
Users
— Blocks that use the variable
cell array
Blocks that use the variable, specified as a cell array of string scalars.
Attributes:
SetAccess | protected |
ModelBlockPath
— Path of Model block that set the variable value
string scalar
Path of the Model block that set the variable value, specified as a string scalar.
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 Configure Instance-Specific Values for Block Parameters in a Referenced Model.
Attributes:
SetAccess | protected |
Methods
Public Methods
getReporter | Get reporter for model variable search result |
getVariableID | Get unique ID of model variable |
getVariableValue | Get value of variable from model variable search result |
getDefaultSummaryProperties | Get list of default summary table properties for a finder result class |
getDefaultSummaryTableTitle | Get default summary table title for finder result class |
getPropertyValues | Get property values of model variable and model variable finder result objects |
getReporterLinkTargetID | Get link target ID of reporter object associated with the finder result object |
Examples
Customize the Formatting of Model Variables in a Report
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 = "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);
Version History
Introduced in R2019b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)