Simulinkモデ​ルの入出力ポートのデ​ータタイプをコマンド​で取得するにはどうす​ればよいですか?

39 Ansichten (letzte 30 Tage)
MathWorks Support Team
MathWorks Support Team am 1 Apr. 2011
Simulinkモデルの入出力ポートのデータタイプをコマンドで取得する方法を教えてください。

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 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')

Weitere Antworten (0)

Kategorien

Mehr zu プログラムによるモデル編集 finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!