How to pass an input value to a Simulink block from M-file?

36 ビュー (過去 30 日間)
Kamran Awan
Kamran Awan 2022 年 10 月 19 日
コメント済み: Kamran Awan 2022 年 10 月 22 日
Hi I'm tring to run a simulink model from M-file using 'sim' command. The simulink model needs some input values, that I'm try to pass from M-file code. But I'm not able to do it. Can anyone help me with this?
I've attached the pictures of M-file code, Simulink Model and error I get.

採用された回答

Benjamin Thompson
Benjamin Thompson 2022 年 10 月 19 日
Your M file can put the data into the base workspace as a variable with a known name. Then your Simulink model can use the From Workspace source block to use it if the data is time based. Or if the data is constant use the constant source block and put the name of your base workspace variable in there.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by