assign parameter values with sim command
3 次查看(过去 30 天)
显示 更早的评论
Suppose I have a Simulink model called myModel.mdl. One of the blocks has a parameter, and I have assigned to it the variable:
sfreq
If I want to set this variable to 0.5 and run the model, then the following code suffices:
sfreq=0.5;
sim('myModel')
However for reasons too complicated to explain here, I would like to make the first command part of the second. If sfreq were a MODEL parameter then I would simply do the following:
sim('myModel','sfreq','0.5')
Unfortunately sfreq is a block parameter, and so I get back the following error:
block_diagram does not have a parameter named 'sfreq'
Any ideas for avoiding this error?
Thanks!
0 个评论
采纳的回答
Azzi Abdelmalek
2013-7-19
编辑:Azzi Abdelmalek
2013-7-19
2 个评论
Azzi Abdelmalek
2013-7-19
You can get the name of your parameter by
get_param('yourmodel/yourblockName', 'Dialogparameters')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multicore Processor Targets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!