How to call callback the code through the selection of push button
Show older comments
Hallo, I am building a GUI. I have used a popupmenu button with two options, for example(a,b). How can i callback the code which i have written in the random pushbutton_x when i select case "a" in my push button. Thanks.
Regards, Anush
4 Comments
Jan
on 15 May 2017
What is a "popupmenu button"? Eitehr it is a popup menu or a button. "example(a,b)" is not clear also. What is "the random pushbutton_x"?
anush
on 15 May 2017
Jan
on 16 May 2017
Please explain the sentence "I am having trouble with calling this pushbutton1_callback with reference to my popupmenu's which i select." Include the code and mention, what trouble you have. Otherwise giving an answer is based on guessing only.
anush
on 16 May 2017
Accepted Answer
More Answers (1)
After your comment: This is no valid Matlab syntax:
if (selectedIndex == 1);
else if (selectedIndex == 2);
h = msgbox('Operation Completed');
end
Either an "end" is missing, or you have to remove the space:
elseif (selectedIndex == 2);
% not: else if (selectedIndex == 2);
For: "How to call the push button operation here ??" Simply by calling the pushbutton callback:
pushbutton_Callback(hObject, eventdata, handles)
It is not used here, but adjusting the data might be better:
pushbutton_Callback(handles.pushbutton1, eventdata, handles)
or how your button is called in the struct. Use the debugger to determine this.
Categories
Find more on Migrate GUIDE Apps 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!