How can I use RGB value?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello! Here is my problem.
I have a code for pop-up menu:
popupmenu=uicontrol(gcf,'Style', 'popup',...
'String', 'Blue|Green|Red|Brown|Grey|Purple|Pink',...
'Position', [100 100 100 50],...
'Callback',...
['sp_col=[''b'',''g'',''r'',''W'',''W'',''W'',''m''];',...
'set(sp,''Color'',sp_col(get(popupmenu,''Value'')));',...
'sp_col=sp_col(get(popupmenu,''Value''));']);
I have RGB values:
brown = [0.5 0.25 0];
grey = [0.4,0.4,0.4];
purple=[0.5 0 0.5];
How can I use this values in my cod (instead of 'W')?
Sorry for my English.
Thank you,
Artem.
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 10월 27일
colors = [0 0 1; 0 1 0; 1 0 0; 0.5 0.25 0; 0.4 0.4 0.4; 0.5 0 0.5; 1 1 0];
(Note: I might have gotten the code for magenta wrong.)
Then,
'Callback', 'sp_col = colors(get(popumenu, ''Value''), :);'
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!