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

load_system("sf_car")
chart = find(slroot,"-isa","Stateflow.Chart", ...
    Name="shift_logic");
slreportgen.utils.getSlSfHandle(chart.Id)
ans = 
  Chart with properties:

                                          Path: 'sf_car/shift_logic'
                               RequirementInfo: ''
          AllowGlobalAccessToExportedFunctions: 1
                           EnableZeroCrossings: 1
                     NoCodegenForCustomTargets: 0
                          NonTerminalMaxCounts: 1000
         RegisterExportedFunctionsWithSimulink: 0
                                        Editor: [1x1 Stateflow.Editor]
                                ActionLanguage: 'MATLAB'
                                    ChartColor: [1 0.9608 0.8824]
                                SelectionColor: [1 0 0.5176]
                        ConstantFoldingTimeOut: 40000
                       DerivativesFormatString: '$N_dot'
                              EmlDefaultFimath: 'Same as MATLAB Default'
                                  EnableBitOps: 0
                       EnableNonTerminalStates: 0
                       ExecuteAtInitialization: 0
                                    ErrorColor: [1 0 0]
                          ExportChartFunctions: 0
                              InitializeOutput: 0
                       FimathForFiConstructors: 'Same as FIMATH for fixed-point input signals'
                                   InputFimath: 'fimath(......'
                                  PortFontSize: 12
                                 JunctionColor: [0.6824 0.3294 0]
                                    OutputData: []
                     SaturateOnIntegerOverflow: 0
                                    StateColor: [0 0 0]
                               StateLabelColor: [0 0 0]
                                     StateFont: [1x1 Stateflow.StateFont]
                               TransitionColor: [0.2902 0.3294 0.6039]
                          TransitionLabelColor: [0.2902 0.3294 0.6039]
                                     TreatAsFi: 'Fixed-point'
              TreatUndefinedSymbolsAsExtrinsic: 0
                              StateMachineType: 'Classic'
    UserSpecifiedStateTransitionExecutionOrder: 1
                                       Visible: 0
                                 HasOutputData: 0
                          OutputMonitoringMode: 'ChildActivity'
                   StateActivityOutputDataType: 'Enum'
                                         Debug: [1x1 Stateflow.ChartDebug]
                                TransitionFont: [1x1 Stateflow.TransFont]
                                       Machine: [1x1 Stateflow.Machine]
                                 Decomposition: 'PARALLEL_AND'
                   NonTerminalUnstableBehavior: 'Proceed'
                         VariantActivationTime: 'update diagram analyze all choices'
                                          Name: 'shift_logic'
                                    SampleTime: '0.04'
                                hadBreakpoints: 0
                                   Description: ''
                                         Dirty: 0
                                      Document: ''
                                          Iced: 0
                                        Locked: 0
                         SupportVariableSizing: 0
          TreatDimensionOfLengthOneAsFixedSize: 1
                                           Tag: []
                                            Id: 424
                                   ChartUpdate: 'DISCRETE'
                            StatesWhenEnabling: 'held'
                              PaperOrientation: 'landscape'
                             PaperPositionMode: 'auto'
                                 PaperPosition: [2.2361 2.0208 6.5278 4.4583]
                                     PaperSize: [11 8.5000]
                                    PaperUnits: 'inches'
                                     PaperType: 'usletter'
                             TiledPaperMargins: [0.5000 0.5000 0.5000 0.5000]
                                TiledPageScale: 1
                            ShowPageBoundaries: 'off'

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