1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@scilab.org> 3// Copyright (C) 2012 - 2016 - Scilab Enterprises 4// 5// This file is hereby licensed under the terms of the GNU GPL v2.0, 6// pursuant to article 5.3.4 of the CeCILL v.2.1. 7// This file was originally licensed under the terms of the CeCILL v2.1, 8// and continues to be available under such terms. 9// For more information, see the COPYING file which you should have received 10// along with this program. 11 12function cmap = coolcolormap(varargin) 13 14 //coolcolormap : consists of colors that are shades of blue and green. 15 16 // Check number of input argument 17 if size(varargin)<>1 then 18 error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), "coolcolormap", 1)); 19 end 20 n=varargin(1); 21 22 // Check type of input argument 23 // Check if input argument is real 24 if typeof(n)<>"constant" | ~isreal(n) then 25 error(msprintf(gettext("%s: Wrong type for input argument #%d: a real scalar expected.\n"), "coolcolormap", 1)); 26 end 27 28 // Check size of input argument 29 if size(n,"*")<>1 then 30 error(msprintf(gettext("%s: Wrong size for input argument #%d: a real scalar expected.\n"), "coolcolormap", 1)); 31 end 32 33 if n==0 then 34 cmap = []; 35 return 36 end 37 38 red = (0:n-1)'/max(n-1,1); 39 green = 1-red; 40 blue = ones(n,1); 41 42 cmap = [red green blue]; 43 44endfunction 45