No BSD License  

Highlights from
Stateflow Chart Data

Stateflow Chart Data

by

 

20 Sep 2002 (Updated )

Display chart data variables, sope and type

chartdata(modelname,chartname)
function dict = chartdata(modelname,chartname)
%
% dict = chartdata(modelname,chartname)
%
%  modelname = Simulink model name - must be an open model
%  chartname = Simulink chart name - with relative path to chart
%
%  dict = output matrix
%
% This m-file puts into the output matrix the declared data variables
% of a state machine and the associated scope and type. Data
% is sorted by data name. Note that this function does not
% report on events.


% First find the stateflow chart

rt=sfroot;

m=rt.find('-isa','Stateflow.Machine','-and','Name',modelname);
chart=m.findDeep('Chart');

s=chart.find('Name',chartname);

% Now get the data for just this stateflow machine

d=s.find('-isa','Stateflow.Data');

names=get(d,'Name');
dt = get(d,'DataType');
sc= get(d,'Scope');

% Sort it

[names,i]=sort(names);
sc=sc(i);
dt=dt(i);

dict = [names sc dt];

Contact us