You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cm_solar.m
    path of file: ./repos/tracacode/1911-COAWST/script/mfiles/rutgers/colormaps
    
    the code of the file until where you have to start completion: function cmap = cm_solar(varargin)

% CM_SOLAR: 256 color palette from CMOCEAN
%
% cmap = cm_solar(M)
%
% SOLAR colormap by Kristen Thyng.

    
function cmap = cm_solar(varargin)

% CM_SOLAR: 256 color palette from CMOCEAN
%
% cmap = cm_solar(M)
%
% SOLAR colormap by Kristen Thyng.
%
% On Input:
%
%    M        Number of colors (integer, OPTIONAL)
%
% On Ouput:
%
%    cmap     Mx3 colormap matrix
%
% Usage:
%
%    colormap(cm_solar)
%    colormap(flipud(cm_solar))
%
% https://github.com/matplotlib/cmocean/tree/master/cmocean/rgb
%
% Thyng, K.M., C.A. Greene, R.D. Hetland, H.M. Zimmerle, and S.F DiMarco, 2016:
%   True colord of oceanography: Guidelines for effective and accurate colormap
%   selection, Oceanography, 29(3), 9-13, http://dx.doi.org/10.5670/oceanog.2016.66 
% 

% svn $Id: cm_solar.m 938 2019-01-28 06:35:10Z arango $

% Initialize.

switch numel(varargin)
  case 0
    M = 256;
  case 1
    M = varargin{1};
end