MATLAB: How to distinguish whether the model currently being viewed is a subsystem or stateflow chart

simulink

I would like to distinguish (true or false) with a command whether the current location is Stateflow Chart or Subsystem, when viewing the Stateflow chart at a specific location in the model in Simulink.

Best Answer

You can use a parameter on subsystem called SFBlockType as below.
isAChart = strcmp(get_param(gcb,'SFBlockType'),'Chart')
Related Question