Error when setting a simulink block parameter

Hello,
When I run: set_param('mdl0_exp/Constant','value','orient')
An empty figure appear and I get this error message: ??? Error using ==> set_param Invalid setting in 'mdl0_exp/Constant' for parameter 'Value'.
I really can't understand why this happens. It looks like Matlab runs the function 'orient'.
What do you think about that?
Flo

回答 (1 件)

Paulo Silva
Paulo Silva 2011 年 3 月 10 日

1 投票

If you want to put the value inside the variable orient in your Constant block you should do:
set_param('mdl0_exp/Constant','value',num2str(orient))

2 件のコメント

Florian
Florian 2011 年 3 月 11 日
Thanks but I would like the value of the block to be 'orient'. So that when the value of my variable called 'orient' changes, the value of the block changes too.
If I use what you said it will put the current value of 'orient' in the block...
Florian
Florian 2011 年 3 月 11 日
It works when I set the variable 'orient' first:
orient=0;
set_param('mdl0_exp/Constant','value','orient');
I think it's because 'orient' also refers to a function and if there's no variable called like that in the workspace Matlab runs the function...

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

カテゴリ

ヘルプ センター および File ExchangeModeling についてさらに検索

タグ

質問済み:

2011 年 3 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by