0

How can I counting number of states in a stateflow diagram via M-Script(hierarchically)?

Leandro Bardelli
  • 10,561
  • 15
  • 79
  • 116
  • You probably need to use [Simulink Design Verifier](http://uk.mathworks.com/products/sldesignverifier/features.html#model-coverage-analysis) to do coverage analysis. This will give you all possible states your Stateflow chart can go into. – am304 Apr 21 '15 at 14:11

1 Answers1

0

you can use Stateflow API to do this:

m = rt.find('-isa','Simulink.BlockDiagram','Name', modelName);
%% find all the Charts in the model
chartList = m.find('-isa','Stateflow.Chart');

%% find all of the  states in level 1 of the first chart 
stateList = chartList(1).find('-isa', 'Stateflow.State', '-depth', 1);
disp(length(stateList));

you must open the model first before running this script.

lililqth
  • 378
  • 1
  • 3
  • 7