From: Laura1282 Wang on
Hi,

I'm creating a GUI for my final year project. I'm new starter of matlab GUI.
I want to creat a GUI to get "x" and 'y" inputs, then use these to inputs to run another .m file. That .m file will give two results: "final_x" and "final_y". And When I click the push botton "estimate", the .m will run and results will be shown in my GUI.

I can run the .m file independently to calculate the "final_x" and "final_y" in matlab with given inputs, but I don't know how to write the callback functions under the push botton to show the results in GUI.

%get the inputs of user
x_tr = str2double(get(hObject,'String'));
y_tr = str2double(get(hObject,'String'));

(What's the part here?)...........................

%Display the estimated position
set(handles.final_x,'String',final_x);
set(handles.final_y,'String',final_y);

Thank you!
From: Husam Aldahiyat on

%get the inputs of user
x_tr = str2double(get(hObject,'String'));
y_tr = str2double(get(hObject,'String'));

[final_x,final_y] = myfun(x_tr,y_tr)

%Display the estimated position
set(handles.final_x,'String',final_x);
set(handles.final_y,'String',final_y);


This of course assumes your .m file is a function with this

[final_x,final_y] = myfun(x_tr,y_tr)

As its first line.
From: Laura1282 Wang on
Thank you very much!!!!

"Husam Aldahiyat" <numandina(a)gmail.com> wrote in message <hocc7u$q16$1(a)fred.mathworks.com>...
>
> %get the inputs of user
> x_tr = str2double(get(hObject,'String'));
> y_tr = str2double(get(hObject,'String'));
>
> [final_x,final_y] = myfun(x_tr,y_tr)
>
> %Display the estimated position
> set(handles.final_x,'String',final_x);
> set(handles.final_y,'String',final_y);
>
>
> This of course assumes your .m file is a function with this
>
> [final_x,final_y] = myfun(x_tr,y_tr)
>
> As its first line.