slreportgen.finder.FunctionReferenceFinder class
Package: 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
Container
— Simulink model or block to search for function references
character array | string scalar | slreportgen.finder.DiagramResult
object | slreportgen.finder.BlockResult
object | model handle | block handle
Simulink model or block to search for function references, specified as one of these values:
Value | Description |
---|---|
Model name | Model name, specified as a string scalar or character vector. For example, "slrgex_sf_car"
|
Path to block | Path to block, specified as a string scalar or character vector. For example "slrgex_sf_car/Engine"
|
Model handle | Model handle, generated by the slreportgen.utils.getModelHandle function. For example slreportgen.utils.getModelHandle("slrgex_sf_car")
|
Block handle | Block handle, generated by the getSimulinkBlockHandle function. For example, getSimulinkBlockHandle("slrgex_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 |
SearchDepth
— Number of levels to search inside container
inf
(default) | nonnegative integer
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 |
FunctionType
— Function type to search for
"all"
(default) | "built-in"
| "user-defined"
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
SearchReferencedModels
— Whether to search in referenced models
true
or 1
(default) | false
or 0
Whether to search in the models that are referenced by the model or block
represented by the Container
property, specified as a logical
1
(true
) or 0
(false
). When SearchReferencedModels
is true:
The finder searches only referenced models within the search depth are searched.
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.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
LookUnderMasks
— Whether to search under masks
true
or 1
(default) | false
or 0
Whether to search under masks, specified as a logical 1
(true
) or 0
(false
).
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
FollowLibraryLinks
— Whether to follow links to library blocks
true
or 1
(default) | false
or 0
Whether to follow links to library blocks, specified as a logical
1
(true
) or 0
(false
).
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
IncludeInactiveVariants
— Whether to search for functions referenced by inactive variants
false
or 0
(default) | true
or 1
Whether to search for functions referenced by inactive variants in variant
subsystems and model variants, specified as a logical 0
(false
) or 1
(true
).
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Properties
— Properties of functions to find
cell array
Properties of functions to find, specified as a cell array of name-value pairs 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.
Data Types: cell
Methods
Public Methods
find |
|
hasNext |
|
next |
|
Examples
Report on MATLAB Function References in Simulink Blocks
This example shows how to find and report on MATLAB function references in Simulink blocks.
Import these packages 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 slrgex_fuelsys
and then compile the model so that the finder searches the most updated version of the model.
modelName = "slrgex_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
iteratively 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 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
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)