Can someone help me? GUIDE

1 次查看(过去 30 天)
Gbola
Gbola 2020-11-28
评论: Gbola 2020-11-28
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 个评论
Jan
Jan 2020-11-28
What have you tried so far and what is your specific question?
Gbola
Gbola 2020-11-28
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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by