Main Content

slreportgen.utils.getSlSfHandle

Get Simulink handle or Stateflow object

Description

example

sisfhandle = slreportgen.utils.getSlSfHandle(path_id) returns the Simulink® or Stateflow® object handle of the input Simulink path, Simulink identifier (SID), or Stateflow numeric ID.

Examples

Obtain Simulink Model and Object Handles

openExample('f14')
modelHandle = slreportgen.utils.getSlSfHandle('f14')
blockHandle = slreportgen.utils.getSlSfHandle('f14/Controller')
SIDHandle = slreportgen.utils.getSlSfHandle('f14:3')
modelHandle =

    2.0001

blockHandle =

   38.0001

SIDHandle =

    6.0001

Obtain Stateflow Chart Handle

Run the following command to access the supporting files used in this example.

openExample('rptgenext/SimulinkReportGeneratorFilesExample');
load_system('slrgex_sf_car')
chart = find(slroot, '-isa',...
   'Stateflow.Chart','Name','shift_logic');
slreportgen.utils.getSlSfHandle(chart.Id)

This example returns the list of Stateflow chart properties to the workspace. The Stateflow handle is equivalent to the Stateflow object. To use a Stateflow handle, assign it to a variable.

Input Arguments

collapse all

Simulink or Stateflow object path or ID, specified as a string or character array. This utility returns the handle of the specified path_id object.

Output Arguments

collapse all

Handle of the specified Simulink or Stateflow object, returned as a double.

Version History

Introduced in R2018b