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: palm_ciftiwrite.m
    path of file: ./repos/CBIG/external_packages/matlab/non_default_packages/palm/palm-alpha109
    
    the code of the file until where you have to start completion: function palm_ciftiwrite(varargin)
% Provides limited support for writing CIFTI files
% (surface only) using the wb_command as the backend.
%
% C = palm_ciftiwrite(filename,data,extra,wb_command)
%
% Inputs:
% - filename    : Filename of the CIFTI (surface only, dtseries).
% - data        : Actual data that will be saved.
% - extra       : Metadata for the CIFTI.
% - wb_command  : (Optional) Full path to the executable wb_command.
% - toscalar    : (Optional) 
% _____________________________________
% Anderson M. Winkler

    
function palm_ciftiwrite(varargin)
% Provides limited support for writing CIFTI files
% (surface only) using the wb_command as the backend.
%
% C = palm_ciftiwrite(filename,data,extra,wb_command)
%
% Inputs:
% - filename    : Filename of the CIFTI (surface only, dtseries).
% - data        : Actual data that will be saved.
% - extra       : Metadata for the CIFTI.
% - wb_command  : (Optional) Full path to the executable wb_command.
% - toscalar    : (Optional) 
% _____________________________________
% Anderson M. Winkler
% FMRIB / University of Oxford
% Apr/2015
% http://brainder.org

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% PALM -- Permutation Analysis of Linear Models
% Copyright (C) 2015 Anderson M. Winkler
% 
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% any later version.
% 
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
% 
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

% Input arguments
narginchk(1,5);
filename = varargin{1};
data     = varargin{2};
extra    = varargin{3};
if nargin == 4 && ~ isempty(varargin{4}),
    wb_command = varargin{4};
else
    wb_command = 'wb_command';
end