Can someone help me? GUIDE

1 view (last 30 days)
Gbola
Gbola on 28 Nov 2020
Commented: Gbola on 28 Nov 2020
Can someone help me?
GUIDE:
I have two pop-up menus each of them containing three strings “red”, “blue” and “green”; one push button; and one edit text on figure1.
If I press the push button, I need It to display the new colour formed as a result of mixing the selected colour from popupmenu1 with the selected colour from popupmenu2, in the edit text.
The desired outputs are:
red + green = yellow (that is, selection of “red” from popupmenu1 and selection of “green” from popupmenu2 will display “yellow” in the edit box when the push button is pressed).
red + blue = magenta
blue + green = cyan
The Callback needs to be implemented using if-elseif-end statements to run.
Many thanks.
  2 Comments
Jan
Jan on 28 Nov 2020
What have you tried so far and what is your specific question?
Gbola
Gbola on 28 Nov 2020
I have put the controls mentioned in the question, on a figure (figure1)
I have written a callback for the push button tagged 'Mix'
The specific question: How do I get the name of the new colour displayed in the edit text after I had selectesd one colour from popupmenu1 and another colour from popupmenu2, and lastly press the push button?
For instance, red + green = yellow (that is, selecting “red” from popupmenu1 and selecting green” from popupmenu2 suppose to display “yellow” in the edit text when the push button is pressed).
See the below callback for the push button. Could you debug it?
function pushbutton_mix_Callback(hobject,eventdata,handles)
if strcmp( selected_string1,'red')&& strcmp( selected_string2,’blue')
set(handles.edittext1,'String','Magenta' )
elseif strcmp( selected_string1,'green')&& strcmp( selected_string2,'blue')
set(handles.prescription_edittext1,'String','Cyan' )
elseif strcmp( selected_string1,'red')&& strcmp( selected_string2,'green')
set(handles.edittext1,'String’,'Yellow' )
else
set(handles.edittext1,'String','Select one colour from each pop-up menu' )
end

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!