Run .m function from GUI

3 views (last 30 days)
Philip
Philip on 25 Jan 2014
Commented: Image Analyst on 25 Jan 2014
I have a GUI that collects user data in the form of numbers. I want the user to hit the pushbutton in the GUI in order to run a function file(.m file) that uses the imputed data of the user to display results
My function file is dish.m
The GUI pushbutton function is this:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
What code do i need to run.

Accepted Answer

Image Analyst
Image Analyst on 25 Jan 2014
Call dish():
[out1, out2, out3] = dish(in1, in2); % or whatever arguments it has.
  4 Comments
Philip
Philip on 25 Jan 2014
Thank you very much @ Image Analyst.
Am grateful for you answer and time. This is the code I imputed and it worked fine.
dish(Er,h,Freq);
I realized it's because the dish.m function is receiving values, I need not make it dish ()
Thank you. My GUI is running fine now.
Image Analyst
Image Analyst on 25 Jan 2014
That's fine. You do not need to accept the values it returns if you don't plan on using them.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!