slreportgen.finder.FunctionReferenceFinder Class
Namespace: slreportgen.finder
Superclasses: mlreportgen.finder.Finder
Description
Use objects of the class slreportgen.finder.FunctionReferenceFinder
to find
function references that are specifically used for calculating parameters in Simulink® blocks.
The slreportgen.finder.FunctionReferenceFinder
class is a handle
class.
Creation
Description
creates a funcRefFinder
= slreportgen.finder.FunctionReferenceFinder(container
)FunctionReferenceFinder
object and sets the Container
property to container
.
sets Properties using one or more
name-value arguments.theReporter
= slreportgen.finder.FunctionReferenceFinder(Name=Value
)
Properties
Simulink model or block to search for function references, specified as one of these values:
Value | Description |
---|---|
Model name | Model name, specified as a character vector or string scalar. For
example, "sf_car"
|
Path to block | Path to block, specified as a character vector or string scalar. For
example "sf_car/Engine"
|
Model handle | Model handle, generated by the slreportgen.utils.getModelHandle function. For example
slreportgen.utils.getModelHandle("sf_car")
|
Block handle | Block handle, generated by the getSimulinkBlockHandle function. For example,
getSimulinkBlockHandle("sf_car/Engine")
|
slreportgen.finder.DiagramResult object | Search result object that represents a Simulink model or subsystem |
slreportgen.finder.BlockResult object | Search result object that represents a Simulink block |
Attributes:
GetAccess | public |
SetAccess | public |
Number of levels to search inside the container, specified as a nonnegative integer
or Inf
to search in an unlimited depth.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: double
Function type to search for, specified as one of these values:
Value | Description |
---|---|
"all" | Search for all function references |
"built-in" | Search for built-in function references |
"user-defined" | Search for user-defined function references |
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: string
| char
Whether to search in the referenced models, specified as a numeric or logical
1
(true
) or 0
(false
). You can search in models that are referenced by the
model or referenced by a block represented by the Container
property.
When SearchReferencedModels
is true:
The finder searches only referenced models within the search depth.
The finder searches referenced models to the depth specified by
SearchDepth
, regardless of the depth of the block that contains the referenced model.The finder searches models that are referenced by referenced models.
Note
You can also set the SearchReferencedModels
property by using
"off"
and "on"
.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Whether to search in masked subsystems, specified as one of these values.
Value | Description |
---|---|
true | Search for variables in masked subsystems. (default) |
false | Do not search for variables in masked subsystems. |
Data Types: logical
Whether to follow library links, specified as one of these values:
Value | Description |
---|---|
true | Follow links into library blocks. Library links are treated as subsystems. (default) |
false | Do not follow links into library blocks. Library links are treated as blocks. |
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Whether to search for functions referenced by inactive variants in variant
subsystems and model variants, specified as a logical 1
(true
) or 0
(false
).
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Properties of functions to find, specified as a cell array of name-value arguments in
the format {"Name","Value"}
. The finder returns only functions that
have the specified properties with the specified values. Supported properties include
any property of the slreportgen.finder.FunctionReferenceResult
class.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: cell
Methods
find |
|
hasNext |
|
next |
|
Examples
This example shows how to find and report on MATLAB function references in Simulink blocks.
Import these namespaces so that you do not have to use long, fully qualified class names.
import slreportgen.report.* import slreportgen.finder.*
Create an slreportgen.report.Report
of type PDF.
theReport = Report("FunctionReferenceReport","pdf");
Open the model sldemo_fuelsys
and then compile the model so that the finder searches the most up-to-date version of the model.
modelName = "sldemo_fuelsys";
open_system(modelName);
slreportgen.utils.compileModel(modelName);
Create an slreportgen.finder.FunctionReferenceFinder
object.
funcRefFinder = FunctionReferenceFinder(modelName);
Set the finder to search in referenced models.
funcRefFinder.SearchReferencedModels = true;
Use the methods hasNext
and next
to fetch the slreportgen.finder.FunctionReferenceResult
objects one at a time.
while(hasNext(funcRefFinder))
nextRes = next(funcRefFinder);
If the referenced function is a built-in function, append the result directly to the report.
if(nextRes.FunctionType == "built-in") append(theReport,nextRes);
If the referenced function is a user-defined function, obtain a handle of the slreportgen.report.FunctionReference
reporter of this result. Customize the reporter to exclude the references table by setting the ShowReferencesTable
property of the reporter to false
. Then append the reporter to the report.
else reporter = getReporter(nextRes); reporter.ShowReferencesTable = false; append(theReport,reporter); end end
Uncompile and close the model.
slreportgen.utils.uncompileModel(modelName) close_system(modelName);
Close and view the report.
close(theReport); rptview(theReport);
Version History
Introduced in R2022a
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)