MATLAB: How to programmatically determine which of the Stateflow symbols have a “local” scope

apilocalprogrammaticpropertiesscopestateflowsymbol [~]symbolsvariable

Is it possible to use the Stateflow API to determine which of my Stateflow symbols have a local scope?

Best Answer

First, enter the following commands in the MATLAB command window to grab all Stateflow symbol data:
>> rt = sfroot;
>> m = rt.find('-isa','Simulink.BlockDiagram');
>> symbols = m.find('-isa','Stateflow.Data')
You can then index into the "symbols" variable to see all the elements of that symbol that can be programmatically accessed. For example, if running the above commands returned a "Stateflow.Data: 3-by-1", then you can see the details for the first element using the following MATLAB command:
>> symbols(1)
You could directly access any of the properties displayed, such as the scope, using the following command:
>> symbols(1).Scope