find Stateflow Test Points in Simulink model

2 ビュー (過去 30 日間)
Andy
Andy 2015 年 6 月 26 日
コメント済み: Andy 2015 年 7 月 15 日
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.

採用された回答

Debarati Banerjee
Debarati Banerjee 2015 年 7 月 7 日
編集済み: Debarati Banerjee 2015 年 7 月 7 日
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.
  1 件のコメント
Andy
Andy 2015 年 7 月 15 日
I still have not gotten around to comparing this answer to the one I came up with while in a holding pattern, but I like it as it looks really similar, and looks like it will catch more Test Points if I ever put one on a state. Here is the essence of what worked for me; at this time, I don't know if Stateflow.State is a subset or different from Stateflow.Data.
MySF = sfroot;
M_atj = find(MySF,'-isa','Simulink.BlockDiagram');
m_sf_atj = M_atj.find('-isa','Stateflow.Chart');
d_sf_atj = m_sf_atj.find('-isa','Stateflow.Data');
TP_sf = d_sf_atj.find('TestPoint', true);
TP_sfPath = get(TP_sf,'Path');
TP_sfName = get(TP_sf,'Name');
for ii=1:length(TP_sf)
TP_list{ii} = [TP_sfPath{ii}, ' ', TP_sfName{ii}];
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStateflow Programmatic Interface についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by