Main Content

slreportgen.utils.getSlSfHandle

Get Simulink handle or Stateflow object

Description

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

example

Examples

collapse all

Open the model f14.

openExample("f14")

Get the handle to the model.

modelHandle = slreportgen.utils.getSlSfHandle("f14")
modelHandle =

    2.0001

Get the handle to the Controller block.

blockHandle = slreportgen.utils.getSlSfHandle("f14/Controller")
blockHandle =

   38.0001

Get the handle to the subsystem that has an SID of 3.

SIDHandle = slreportgen.utils.getSlSfHandle("f14:3")
SIDHandle =

    6.0001

Open the model sf_car.

openExample("sf_car")

Find the Stateflow numeric ID for the shift_logic chart.

chart = find(sfroot,"-isa","Stateflow.Chart",Name="shift_logic");
chart.Id
ans =

    24

Find the Stateflow.Chart object that has a Stateflow numeric id equal to 24.

chartObj = slreportgen.utils.getSlSfHandle(chart.Id);
class(chartObj)
ans =

    'Stateflow.Chart'
chartObj.Name
ans =

    'shift_logic'

Input Arguments

collapse all

Simulink or Stateflow object path or ID, specified as a string, character array, or double.

Output Arguments

collapse all

Handle of the specified Simulink or Stateflow object, returned as a double or as a Stateflow API object such as Stateflow.Chart or Stateflow.State. For more information about Stateflow API objects, see Summary of Stateflow API Objects and Properties (Stateflow).

Version History

Introduced in R2018b