how can i take the values from edit_text of gui to function

2 views (last 30 days)
I am writing a program for fluid kinematics. It is working, but i want to show in matlab gui.
function ut=u(x,y);
ut=3*x+y
end
it accepts
function ut=u(x,y);
ut=(get(handles.edit11,'String'))
end
but it does not accept it.
i want to get values from edit_text. Can you help for this?
  3 Comments
esat gulhan
esat gulhan on 30 Dec 2019
It says "Undefined variable "handles" or class "handles.ugui"." when i put

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 30 Dec 2019
function ut = u(handles, x, y)
ut = handles.edit11.String
evalc(ut)
end
  2 Comments
Jason
Jason on 31 Dec 2019
Shouldn't there be a get ...
get(handles.edit11,'String')
Image Analyst
Image Analyst on 31 Dec 2019
No - that's the old fashioned way - pre release 2014b. The newer way is like the object oriented programming (OOP) way that all modern languages use now. I'm using the new/current OOP way.

Sign in to comment.

More Answers (1)

esat gulhan
esat gulhan on 31 Dec 2019
It is definetly good way. (practical). it works...thanks

Community Treasure Hunt

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

Start Hunting!