How can I get the port number of a StateFlow input given it's handle programatically?
古いコメントを表示
I have the handle of a StateFlow input from a previous find result. I'm trying to get the port number for that StateFlow input. I've been using the sf('get',<handle num>,<field name>) command for other fields like 'data.name', 'data.scope', etc. but can't see where I can get the port number. Can anyone help me with this?

1 件のコメント
David Berggren
2025 年 2 月 6 日
chart = find(sfroot, '-isa', 'Stateflow.Chart', 'Name', 'YourChartName');
inputs = chart.find('-isa', 'Stateflow.Data', '-and', 'Scope', 'Input');
for i = 1:numel(inputs)
fprintf('Port %d: %s\n', inputs(i).Port, inputs(i).Name);
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Stateflow Programmatic Interface についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!