필터 지우기
필터 지우기

set_param() equivalent inside Simulink?

조회 수: 2 (최근 30일)
Roman
Roman 2013년 4월 25일
I may be missing the obvious here, but here's my question:
I use a MIDI controller to select one of three outputs of my Simulink model via buttons on that MIDI controller.
I have that Simulink model synced with a GUI (no easy feat by itself), but only one-way sync right now: in the GUI I display which output is selected using the event listener functions.
So Simulink model --> GUI works okay-ish.
Now I want the user to be able to also select via the GUI which output is active.
I could use a constant block supplying an input to my output selector and change that value using set_param() from the GUI. But how would I change that constant value from inside Simulink? set_param() does not work inside embedded Matlab, and I need to compile the model for performance reasons (i.e. I can't use coder.extrinsic).

채택된 답변

Kaustubha Govind
Kaustubha Govind 2013년 4월 25일
In general, it is discouraged to change a block's parameter from another block (see the blog post How Do I Change a Block Parameter Based on the Output of Another Block?). Why not just get rid of the Constant block and create an output to the Embedded MATLAB block that controls the output Selector directly?
  댓글 수: 3
Kaustubha Govind
Kaustubha Govind 2013년 4월 29일
You can create parameters on the EML block, and set those parameters from the GUI.
Roman
Roman 2013년 5월 6일
Thank you Kaustubha, I will try that.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by