Filter löschen
Filter löschen

Can someone help me? GUIDE

1 Ansicht (letzte 30 Tage)
Gbola
Gbola am 28 Nov. 2020
Kommentiert: Gbola am 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 Kommentare
Jan
Jan am 28 Nov. 2020
What have you tried so far and what is your specific question?
Gbola
Gbola am 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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by