Simulinkモデルの入出力ポートのデータタイプをコマンドで取得するにはどうすればよいですか?
10 views (last 30 days)
Show older comments
Simulinkモデルの入出力ポートのデータタイプをコマンドで取得する方法を教えてください。
Accepted Answer
MathWorks Support Team
on 1 Apr 2011
モデルのコンパイルを行った後、'CompiledPortDataType'プロパティを取得することで、データタイプを取得することができます。
% モデルオープン
open_system('vdp')
% モデルのコンパイル
vdp([],[],[],'compile');
% 全ブロックの取得
BlockName = find_system('vdp','Regexp','on','BlockType','.');
% ポートハンドルの取得
h = get_param(BlockName,'Porthandles');
for n=1:length(h)
disp('ブロック名:')
disp(BlockName{n})
% 入力ポートのデータタイプを取得
disp('入力ポートのデータタイプ:')
disp(get_param(h{n}.Inport,'CompiledPortDataType'))
% 出力ポートのデータタイプを取得
disp('出力ポートのデータタイプ:')
disp(get_param(h{n}.Outport,'CompiledPortDataType'))
disp(char(10))
end
% コンパイルの終了
vdp([],[],[],'term')
0 Comments
More Answers (0)
See Also
Categories
Find more on プログラムによるモデル編集 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!