Passing data from pop up menu to a push button using conditional statements
Show older comments
Hello all Im creating a GUI, and I seem to be stuck with passing my data through from my popup menu whenever I push the button, the if statements are used to return the correct data depending on the users input value called 'norder' into the Edit text box, right now its trying to return data before the pushbutton is pressed an the user 'norder' is stored. Here's a snippet of the code if anybody knows my mistake in this code it would be very helpful to me in resolving this problem. Thank you in advance.
Code: % --- Executes on selection change in ripplemenu popup menu.
function ripplemenu_Callback(hObject, eventdata, handles)
handles = guidata(hObject);
switch get(handles.ripplemenu,'Value')
case 1
if norder == 2
butt=[0.8431, 0.6220, 0.07378]
end
if norder == 3
butt=[1.0316, 1.1474, 1.0316]
end
if norder == 4
butt=[1.1088, 1.3062, 1.7704, 0.8181, 0.7378]
end
butt.handles = butt;
guidata(hObject, handles);
%pushbutton
function calculate_Callback(hObject, eventdata, handles)
norder=handles.n
butt=get(handles.ripplemenu, 'UserData')
set(handles.uitable1, 'UserData', butt);
Answers (1)
Categories
Find more on Programming 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!