Guest User

Matlab color map

a guest
Oct 23rd, 2015
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function [ uni_colors ] = unicmap(n)
  2. %UNICMAP Get a matrix of colors
  3. %   unicmap returns a matrix of 9 colors
  4. %   unicmap(n) returns the color with index n. n must be in [1..9].
  5.  
  6. % uni_hellgrau = [224/255 224/255 224/255];
  7. % uni_mittelgrau = [128/255 128/255 128/255];
  8. % uni_dunkelgrau = [80/255 80/255 80/255];    
  9.  
  10. narginchk(0, 1);
  11.  
  12. uni_colors = [0 126/255 198/255]; % mittelblau
  13. uni_colors = [uni_colors; 238/255 28/255 35/255]; % rot
  14. uni_colors = [uni_colors; 140/255 198/255 62/255]; % apfelgruen
  15. uni_colors = [uni_colors; 1 221/255 0]; % gelb
  16. uni_colors = [uni_colors; 244/255 111/255 33/255]; % orange
  17. uni_colors = [uni_colors; 237/255 0 140/255]; % pink
  18. uni_colors = [uni_colors; 19/255 31/255 31/255]; % anthrazit
  19. uni_colors = [uni_colors; 0/255 170/255 173/255]; % turquoise
  20. uni_colors = [uni_colors; 128/255 40/255 145/255]; % lila
  21.  
  22. if nargin == 1
  23.     if (~isscalar(n) || ~isnumeric(n))
  24.         error('First argument must be a numeric scalar.')
  25.     end
  26.     if (n < 1 || n > size(uni_colors, 1))
  27.         error(['First argument mus be postive and less than or equal to '...
  28.             num2str(size(uni_colors, 1))]);
  29.     end
  30.     uni_colors = uni_colors(n,:);
  31. end
  32.  
  33. end
RAW Paste Data