Set parameter of Simulink
1 次查看(过去 30 天)
显示 更早的评论
Hi. I have created an '*.m' file with a string which calls a simulink file:
Temperature= sim('TRT_tuning','SrcWorkspace','Current','stoptime','359');
Now, I'd like to set the stoptime, i.e. '359', from the workspace (like the command 'input'). How Can I do this? Thanking you for your attention, I'm looking forward for your answers.
0 个评论
回答(2 个)
Azzi Abdelmalek
2012-10-22
编辑:Azzi Abdelmalek
2012-10-22
set_param('TRT_tuning','stop time','359')
or
stime=359
set_param('TRT_tuning','stop time',num2str(stime))
0 个评论
Kaustubha Govind
2012-10-22
You could probably use a model callback function like PostLoadFcn or InitFcn to call any MATLAB code (like INPUT) to get the value from user input and use SET_PARAM with that value.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!