필터 지우기
필터 지우기

Calling a function from m.file into a pushbutton in GUI

조회 수: 1 (최근 30일)
Maximilian Rauch
Maximilian Rauch 2020년 6월 5일
편집: Ana Gonçalves 2020년 6월 5일
Hi,
I have a m.File with the a function "myfun(input)" and a GUI with a pushbutton. I want to run that mfile function by pressing the pushbutton. I don´t know how to implemente it correctly into the pushbutton-function.
Any help would be great!
This one doesn´t work :/:
function generatebtn_Callback(hObject, eventdata, handles)
input=xyz;
myfun(input);
Thank you:)
  댓글 수: 5
Ruger28
Ruger28 2020년 6월 5일
Probably an obvious question, but is your .m file called myfun.m ?
Maximilian Rauch
Maximilian Rauch 2020년 6월 5일
편집: Maximilian Rauch 2020년 6월 5일
I´m new to Matlab ...I thought with myfun I would only call the m.File to run and not the function itself(with its inputs).
Thank you and sorry for the stupid question :D

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

답변 (1개)

Ana Gonçalves
Ana Gonçalves 2020년 6월 5일
편집: Ana Gonçalves 2020년 6월 5일
To open .m files with a pushbutton use this:
% --- Executes on button press in pushbutton
function pushbutton_Callback(hObject, eventdata, handles)
strM_File = ('C:\Users\Desktop\Matlab\YourMFileNameHere.m'); %The folder which contains your .m file
open (strM_File);

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by