Hi, I've created a script with several edit boxes and I need that they interact with themselves and update its string values only when the end user enter data in some of them. This is part of my script:
%Edit boxes where the user inserts or changes data
e0 = uicontrol('Style','edit','Position',[150 105 80 20],'String','15'); %Default value, but user can change it.
e1 = uicontrol('Style','edit','Position',[150 80 80 20]);e2 = uicontrol('Style','edit','Position',[150 55 80 20]);e3 = uicontrol('Style','edit','Position',[150 20 80 20];%Edit box that needs to be updated only when the user inputs data in the previous edit boxes.
e4 = uicontrol('Style','edit','Position',[285 140 50 20],'Enable','off');
And now I want to define a function or a callback to update automatically the value of the last edit box, along these lines:
h1 = get(e1,'String'); h2 = get(e2,'String');h3 = str2num(h1) + str2num(h2);v1 = str2num(get(e3,'String'));var = str2num(get(e0,'String'));v2 = num2str(v1*171233*((288+var)-0.00198*h3)^0.5/(288-0.00198*h3)^2.628);set(e4,'String',v2);
Any help is welcome. Thanks in advance.
Best Answer