setting parameters for 4 Blocks (wrong number of input arguments, should be odd?)

6 次查看(过去 30 天)
Hello,
when i set the Parameters for 1 Block i dont have any Problems( 3 input arguments )
But as soon as i want to do it for 4 i get an error message
set_param('model/Transfer Fcn','Denominator','T11','model/Transfer Fcn1','Denominator','T12','model/Transfer Fcn2','Denominator','T21','model/Transfer Fcn3','Denominator','T22');
Wrong number (12) of input arguments detected
At least 3 arguments are needed for set_param.
The number of arguments should be an odd value.
that doesnt make any sense to me , since there are 3 input arguments for every Block.
why do i get an error and how can i solve it ?
thanks in advance and
Kind regards,
Bünyamin

采纳的回答

Rollin Baker
Rollin Baker 2017-4-13
Hi Bünyamin,
The reason you are seeing this error is because the 'set_param' function is only meant to be called on a single block at a time. You will need to call it on each block individually. For example:
set_param('model/Transfer Fcn','Denominator','T11');
set_param('model/Transfer Fcn1','Denominator', 'T12');
set_param('model/Transfer Fcn2','Denominator','T21');
set_param('model/Transfer Fcn3','Denominator','T22');
This will give you the behavior you want without any errors. If you want to learn more about the 'set_param' function, check out the documentation page below:
I hope this helps. Good luck with your project!
-Rollin

更多回答(0 个)

类别

Help CenterFile 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!

Translated by