MATLAB: Find Stateflow Test Points in Simulink model

stateflowtest points

I need to find all of the Stateflow Test Points in all charts of a SImulink model. In my experience, find_system can only be used to find Test Points in native Simulink, but not Stateflow. I am lost; please help.

Best Answer

The following piece of code will list the names of all the states in a model ('model_name.slx') with 'Test Point' enabled.
rt = sfroot;
m = rt.find('-isa', 'Simulink.BlockDiagram','-and','Name', 'model_name');
allStates = m.find('-isa','Stateflow.State','TestPoint',1);
p=get(allStates,'Name')
You can refer to this link for more information on Stateflow API.