How can I use set_param in MATLAB function block
18 次查看(过去 30 天)
显示 更早的评论
Hi, I am trying to call a m file from Simulink. I have to use set_param in my code in MATLAB function block, but I am getting this error: Function 'set_param' is not supported for code generation. Consider adding coder.extrinsic('set_param') at the top of the function to bypass code generation.
Any idea?
1 个评论
oshri rozenheck
2019-2-12
Consider adding coder.extrinsic('set_param') at the top of the function to bypass code generation
回答(1 个)
Stefanie Joubert
2022-10-23
I know this is much too late, but I was having the same issue where I wanted feedback from a parameter inside my state changes to affect my settings knob in the parent workspace. I could access it with a script using get_param but while running the same inside of my simulink it said something like 'cannot write function'. Using your error it worked first time.
The image shows adding it in the action of a state change will change the limits of my knob value.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1166413/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1166413/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1166418/image.png)
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!