0
如何通過M-Script(分層)對狀態流圖中的狀態數進行計數?計數StateFlow中的狀態數
如何通過M-Script(分層)對狀態流圖中的狀態數進行計數?計數StateFlow中的狀態數
你可以用Stateflow的API來做到這一點:
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));
必須運行此腳本之前先打開模型。
您可能需要使用[Simulink Design Verifier](http://uk.mathworks.com/products/sldesignverifier/features.html#model-coverage-analysis)進行覆蓋率分析。這將爲您提供Stateflow圖表可以進入的所有狀態。 – am304