getSimulinkBlockHandle
Get block handle from block path
Description
returns
the numeric handle of the block specified by handle
= getSimulinkBlockHandle(path
)path
,
if it exists in a loaded model or library. Returns -1
if
the block is not found. Library links are resolved where necessary.
Use the numeric handle returned by getSimulinkBlockHandle
to
manipulate the block in subsequent calls to get_param
or set_param
.
This approach is more efficient than making multiple calls to these
functions using the full block path. Do not try to use the number
of a handle alone (e.g., 5.007
) because you usually
need to specify many more digits than MATLAB® displays. Assign
the handle to a variable and use that variable name to specify a block.
The handle applies only to the current MATLAB session.
Use getSimulinkBlockHandle
to check whether
a block path is valid. This approach is more efficient than calling get_param
inside
a try
statement.
attempts
to load the model or library containing the specified block handle
= getSimulinkBlockHandle(path
,true)path
,
and then checks if the block exists. No error is returned if the model
or library is not found. Any models or libraries loaded this way remain
in memory even if the function does not find a block with the specified
path.
Examples
Input Arguments
Output Arguments
Version History
Introduced in R2015a