Access Code of Stateflow States via find_system

2 views (last 30 days)
Hey,
I am trying to find out if/how I can access the content of states that I've got inside of a Stateflow Chart (I'd like to get access to the code to check some syntax errors) from within MATLAB.
I already tryed to access the states via find_system('myModel','FindAll', 'on','MaskType','Stateflow') which gives me the Chart, but from there on I've got no Idea how to access the code within the States in that Chart.
Would be awesome if somebody could help me.
Kind regards, Lars

Answers (1)

Lars Schürmann
Lars Schürmann on 6 Aug 2014
For everybody who cares... This is how I did it now...
model = rt.find('-isa', 'Simulink.BlockDiagram', '-and', 'Name', 'myModel'); chart = model.find('-isa','Stateflow.Chart'); states = find(ch, '-isa','Stateflow.State');
for i=1:length(states) text = states(i).Label; %contains text of each of the states end

Categories

Find more on Complex Logic in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!