how to Pass data in gui
Show older comments
I want to pass data from a popupmenu to a pushbutton.How can I improve my coding below to effectively pass data from a popup menu to a button by using setappdata and getappdata so that it can either use value in case 1 or case 2.The popup menu gets data from another pushbutton
function popupmenu1_Callback(hObject, eventdata, handles) contents =get(hObject,'Value');
switch contents case 1 % User selected the first item to=getappdata(handles.pushbutton11,'img'); setappdata(handles.pushbutton11,'img',to); case 2 % User selected the second item to=getappdata(handles.pushbutton10,'img'); setappdata(handles.pushbutton10,'img',to); end
function pushbutton10_Callback(hObject, eventdata, handles) tod=getappdata(handles.pushbutton10,'img'); tod=getappdata(handles.pushbutton11,'img'); n=((b * y)+(a * z)+(c*x)+(d * w)+(e*v)+(f*u)); %these are number already defined det=((((1+ (g/100)).^h)-1)/(g/100)); CNesa=(n*365* det);
SNf=((((CNesa/((1/R)*(10^-0.83)*(tod^1.395)))^0.1068)-1)*25.4); set(handles.SN,'String',SNf);
Answers (0)
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!