How to call a function (another .m file) in MATLAB GUI?

조회 수: 1 (최근 30일)
Ekin
Ekin 2013년 8월 27일
I want to call an another .m file in my main gui .m file. But when i call the function, it gives me error due to "handles." operators.
If i change "handles." operators in the .m function file, i can't get any result in gui figure.
How to fix this problem? Thanks in advance!

채택된 답변

Jan
Jan 2013년 8월 27일
When you get an error message, it is a good idea, to post it here. Posting the relevant part of the code allows us to understand what happens.
"handles." is not an operator, but a struct.
  댓글 수: 2
Ekin
Ekin 2013년 8월 27일
Well you are right. I get this error when I try to call the function:
Undefined function or variable "handles".
Error in Murthy (line 71) axes(handles.axes2);
Error in Myprogram>pushbutton1_Callback
(line 106)
qwertyu=Murthy(result);
I think i solved the problem right now. Just deleted the axes line and pasted it below button function.
Jan
Jan 2013년 8월 27일
편집: Jan 2013년 8월 27일
Or you can provide the handles struct as input to the Murthy function:
qwertyu=Murthy(result, handles);
...
function Reply = Murthy(result, handles)
...

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by