Can someone help me? GUIDE

2 ビュー (過去 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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by