How can I use set_param in MATLAB function block

조회 수: 25 (최근 30일)
Amira chriki
Amira chriki 2018년 2월 27일
답변: Stefanie Joubert 2022년 10월 23일
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
oshri rozenheck 2019년 2월 12일
Consider adding coder.extrinsic('set_param') at the top of the function to bypass code generation

댓글을 달려면 로그인하십시오.

답변 (1개)

Stefanie Joubert
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.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by