Simlinkで構造体を使用したい
Show older comments
Matlabで作成したシミュレーションを,Simlinkに移行しようとしています.
膨大な量のパラメータや条件を,グローバルな構造体で複数の関数に受け渡しています.
同じようなことをSimulinkでも行いたいです.
構造体を使うのは,すべて自分で用意したmatlab function内です.
グローバルな構造体は例えば
data.A.a = 1; data.A.b = 2; data.A.cd = [0 1];
data.B.typ = 'abc', data.B.d = 123;
data.C.C.C.c = [1 2 3; 4 5 6; 7 8 9];
といった具合に,最上階層はdataのみで,それ以下の階層では階層数や配列や文字列,数値が混在しています.
また初期化として,matalbコード上で構造体を作成し,ワークスペースからSimlinkに渡したいです.
Accepted Answer
More Answers (1)
Toshinobu Shintai
on 19 Jul 2019
0 votes
ワークスペースに構造体が定義されているのであれば、
以下の画像のように「Constant」や「String Constant」に直接入力することで使用することができます。
この方法で問題ありませんでしょうか。

1 Comment
Kento SHIRAKATA
on 20 Jul 2019
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!