How can I use set_param in MATLAB function block

23 vues (au cours des 30 derniers jours)
Amira chriki
Amira chriki le 27 Fév 2018
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 commentaire
oshri rozenheck
oshri rozenheck le 12 Fév 2019
Consider adding coder.extrinsic('set_param') at the top of the function to bypass code generation

Connectez-vous pour commenter.

Réponses (1)

Stefanie Joubert
Stefanie Joubert le 23 Oct 2022
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.

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by