Parameters from MATLAB function in Simulink

1 回表示 (過去 30 日間)
Jasper Mattijs
Jasper Mattijs 2014 年 5 月 6 日
Hi
I'm writing a function in MATLAB. In this function I call a Simulink diagram with following command: sim('diagram', 'vxin', value) The error I get is: block_diagram does not have a parameter named 'vxin'. In the diagram I have a constant block where I entered vxin. Clearly this isn't the right way.
How can I fix this?
Thanks
  1 件のコメント
Santosh Gnanasekaran
Santosh Gnanasekaran 2018 年 1 月 1 日
Probably 'vxin' is not in the base workspace as its value is undefined. you can assign any constant\variable in simulink pertaining to that particular block and then try again.

サインインしてコメントする。

採用された回答

A Jenkins
A Jenkins 2014 年 5 月 6 日
編集済み: A Jenkins 2014 年 5 月 6 日
It depends on how you want to manage the scope of vxin .
Simple option:
vxin=value;
sim('diagram');
or maybe you want something like:
h=get_param('diagram','modelworkspace');
h.assignin('vxin',value);
sim('diagram');

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by