A script rancolors displays random colors in the Figure Window as shown in the Figure below. It starts with a variable nColors which is the number of random colors to display (e.g., below this is 10)
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:13| Question number:5.13
All Answers
total answers (1)
rancolors.m
% Create n random colors and then display
% these in a row vector "image"
ncolors = 10;
mycolormap = rand(ncolors,3);
colormap(mycolormap)
vec = 1:ncolors;
image(vec)
need an explanation for this answer? contact us directly to get an explanation for this answer