![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1138740/image.png)
Simulinkブロックの入力信号の型を調べる
조회 수: 8 (최근 30일)
이전 댓글 표시
Simulinkブロックの入力信号の型を調べたいです。
下記のようなスクリプトを作ってみたのですが、SubSytemからの出力信号だと、型を抽出できません。
LineStatus = get_param(gcb,'LineHandles'); % 接続ラインの情報
SorceBlock = get_param(LineStatus.Inport,'SrcBlockHandle'); % 接続元のブロック
DataType = get_param(SorceBlock,'OutDataTypeStr'); % 信号の型
他にスマートな調べ方はありますか
댓글 수: 0
채택된 답변
交感神経優位なあかべぇ
2022년 9월 28일
Simulinkは、モデルをコンパイルしたときに、信号のデータ型が確定します。
feval('モデル名', [], [], [], 'compile'); コマンドを使用し、モデルをコンパイルされた状態にします。
その状態で、任意のポートハンドルを取得し、ポートハンドルの、CompiledPortDataTypeを取得することで、そのポートのデータ型を取得できます。
最後に、feval('モデル名', [], [], [], 'term')コマンドで、コンパイル状態を解除します。
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1138740/image.png)
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!