import constants to simulink
古いコメントを表示
I want to import some constants values from workspace to simulink.
For example i will write A=10, B=7, C=8 in an m.file then i will run it. So, it will be loaded to my work space.
How can i import them to Simulink ?? From workspace block give me an error message 'Invalid matrix-format ...'
採用された回答
その他の回答 (2 件)
Mischa Kim
2015 年 2 月 25 日
1 投票
Ameen, a standard approach is through callbacks. In your Simulink model go to > File > Model Properties > Model Properties, navigate to the Callbacks tab and add commands as necessary. See the documentation for more detail.
3 件のコメント
ameen
2015 年 2 月 25 日
Mischa Kim
2015 年 2 月 25 日
編集済み: Mischa Kim
2015 年 2 月 25 日
You can simply assign the values for A, B, etc. in the InitFcn callback. Treat the text window just like you would work in the MATLAB command window. Alternatively, you can execute scripts, if you need to load more stuff.
ameen
2015 年 2 月 25 日
Saburi Ashtekar
2018 年 2 月 2 日
0 投票
a=10 b=20
カテゴリ
ヘルプ センター および File Exchange で Model, Block, and Port Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!