필터 지우기
필터 지우기

Getting handle for interpreted MATLAB function in Simulink ?

조회 수: 1 (최근 30일)
Sourbh Bhadane
Sourbh Bhadane 2015년 5월 21일
댓글: Sourbh Bhadane 2015년 5월 22일
Hi,
I am building a GUI for a Simulink model that contains an Interpreted MATLAB Function block. I want to update the variables inside the MATLAB function of the Interpreted MATLAB Function block using the GUI. But I can't get the handle for the Interpreted MATLAB Function block. Any ideas on how to do this ?

채택된 답변

Anthony Poulin
Anthony Poulin 2015년 5월 21일
Hello,
How do you try to catch the handle? Using get_param($blockRoot,'handle'), I catch the handle.
Using set_param($blockRoot, 'MATLABFcn', fcnName), I can change the function in the mask of the Interpreted Matlab function.
  댓글 수: 4
Sourbh Bhadane
Sourbh Bhadane 2015년 5월 22일
I tried the command find_system('modelName','BlockType','MATLABFcn'). I got the result in a variable s as [1x30 char]. I tried to use this char string in set_param by doing set_param(s,'MATLABFcn','functionname') but it gave a 'Invalid Simulink object specifier' error.
Sourbh Bhadane
Sourbh Bhadane 2015년 5월 22일
Hi, I finally got how to do this, I did :
s = find_system('modelName','BlockType','MATLABFcn')
a = get_param(s,'Handle')
set_param(a{1},'MATLABFcn','functionname')
Thanks for your help. However, I guess changing the variables inside the MATLAB function cannot be done programmatically

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

추가 답변 (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