The ability to determine how a particular "Data Store Memory" data object is used in a Stateflow chart is not available in Stateflow.
To work around this issue, you can write your own MATLAB file function that uses the Stateflow API to obtain the expressions in a transition, state, or other chart object that indicate how the "Data Store Memory" is being used. As an example, you might use the following commands in the Stateflow API to access expressions in a transition and state:
rt = sfroot;
m = rt.find('-isa', 'Simulink.BlockDiagram', '-and', 'Name','myModel');
chart = m.find('-isa','Stateflow.Chart','-and','Name','mychart');
trans = find(chart, '-isa','Stateflow.Transition');
states = find(chart, '-isa','Stateflow.State');
transString = trans(1).LabelString;
statesString = states(1).LabelString;
One way to determine if the "Data Store Memory" data object is being read from or written to is to see if it is on the right or left side of an "=" sign. You can determine this by parsing the transString and statesString strings. You can also use the STRFIND command to get the location of the "Data Store Memory" variable and the "=" sign in the expressions contained in transString and statesString strings.
Best Answer