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