Main Content

Simulink.ID.getHandle

(Not recommended) Get handle of object associated with Simulink Identifier

Simulink.ID.getHandle is not recommended. Use alternative functions instead.

For more information, see Compatibility Considerations.

Description

example

handle = Simulink.ID.getHandle(SID) returns the handle of the object for the specified Simulink® Identifier SID.

Examples

collapse all

Open the model vdp.

openExample('simulink_general/VanDerPolOscillatorExample')

Get the Simulink Identifier (SID) of the Sum block.

SID = Simulink.ID.getSID('vdp/Sum');

Get the handle of the Sum block using the SID.

handle = Simulink.ID.getHandle(SID)

Input Arguments

collapse all

Simulink Identifier (SID), specified as a character vector or string scalar.

To get the SID for an object, use the Simulink.ID.getSID function.

Example: 'vdp:4'

Data Types: char | string

Output Arguments

collapse all

Object handle, returned as a numeric scalar.

Data Types: double

Version History

Introduced in R2009b

collapse all

R2020a: Not recommended

Simulink.ID.getHandle is not recommended. Use alternative functions instead.

This table shows some typical usages of Simulink.ID.getHandle and how to update your code.

Handle TypeNot RecommendedRecommended
Block
SID = Simulink.ID.getSID('vdp/Sum');
handle = Simulink.ID.getHandle(SID)
handle = getSimulinkBlockHandle('vdp/Sum')
Annotation
object = getCurrentAnnotation;
SID = Simulink.ID.getSID(object)
handle = Simulink.ID.getHandle(SID)
object = getCurrentAnnotation;
handle = object.Handle
Stateflow object
chart = find(slroot, '-isa',...
   'Stateflow.Chart','Name','shift_logic');
SID = Simulink.ID.getSID(chart);
Simulink.ID.getHandle(SID)
chart = find(slroot, '-isa',...
   'Stateflow.Chart','Name','shift_logic');

The Stateflow handle is equivalent to the Stateflow object.