How can I use RGB value?
5 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Walter Roberson
on 27 Oct 2012
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 Comments
See Also
Categories
Find more on Simulink Environment Customization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!