MATLAB Answers

how to built custom a colormap

3 views (last 30 days)
ha ha
ha ha on 9 Feb 2019
Commented: madhan ravi on 9 Feb 2019
I want to built "colorRGB" matrix with k-by-3 matrix (k is predefined number by the user)
Let's say: I need 5 colors (k=5; & random color, but NOT include white color)
colorRGB=[0, 0.4470, 0.7410; 0, 0, 1; 0.85, 0.32, 0.09; 0, 0.75, 0.75; 0.25, 0.25, 0.25];.
colorRGB=[0, 0.4470, 0.7410
0, 0, 1
0.85, 0.32, 0.09
0, 0.75, 0.75
0.25, 0.25, 0.25]
How can I do that? In case I want to build 100 random color matrix. How can I do that?
(Plz see picture below for visualization)

Accepted Answer

Image Analyst
Image Analyst on 9 Feb 2019
Try this:
yourColormap = rand(k, 3); % Colormap with k random colors.
  3 Comments
madhan ravi
madhan ravi on 9 Feb 2019
Thank you for clarifying sir Image Analyst.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!