![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1138740/image.png)
Simulinkブロックの入力信号の型を調べる
46 views (last 30 days)
Show older comments
Mamoru Mabuchi
on 21 Sep 2022
Answered: 交感神経優位なあかべぇ
on 28 Sep 2022
Simulinkブロックの入力信号の型を調べたいです。
下記のようなスクリプトを作ってみたのですが、SubSytemからの出力信号だと、型を抽出できません。
LineStatus = get_param(gcb,'LineHandles'); % 接続ラインの情報
SorceBlock = get_param(LineStatus.Inport,'SrcBlockHandle'); % 接続元のブロック
DataType = get_param(SorceBlock,'OutDataTypeStr'); % 信号の型
他にスマートな調べ方はありますか
0 Comments
Accepted Answer
交感神経優位なあかべぇ
on 28 Sep 2022
Simulinkは、モデルをコンパイルしたときに、信号のデータ型が確定します。
feval('モデル名', [], [], [], 'compile'); コマンドを使用し、モデルをコンパイルされた状態にします。
その状態で、任意のポートハンドルを取得し、ポートハンドルの、CompiledPortDataTypeを取得することで、そのポートのデータ型を取得できます。
最後に、feval('モデル名', [], [], [], 'term')コマンドで、コンパイル状態を解除します。
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1138740/image.png)
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!