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: ft_preproc_padding.m
    path of file: ./repos/fieldtrip/preproc
    
    the code of the file until where you have to start completion: function [dat] = ft_preproc_padding(dat, padtype, prepadlength, postpadlength)

% FT_PREPROC_PADDING performs padding on the data, i.e. adds or removes samples
% to or from the data matrix.
%
% Use as
%   [dat] = ft_preproc_padding(dat, padtype, padlength)
% or as
%   [dat] = ft_preproc_padding(dat, padtype, prepadlength, postpadlength)
% where
%   dat           data matrix (Nchan x Ntime)
%   padtype       'zero', 'mean', 'localmean', 'edge', 'mirror', 'nan' or 'remove'
%   padlength     scalar, number of samples that will be padded
%   prepadlength  scalar, number of samples that will be padded before the data
%   postpadlength scalar, number of samples that will be padded after the data
%

    
function [dat] = ft_preproc_padding(dat, padtype, prepadlength, postpadlength)

% FT_PREPROC_PADDING performs padding on the data, i.e. adds or removes samples
% to or from the data matrix.
%
% Use as
%   [dat] = ft_preproc_padding(dat, padtype, padlength)
% or as
%   [dat] = ft_preproc_padding(dat, padtype, prepadlength, postpadlength)
% where
%   dat           data matrix (Nchan x Ntime)
%   padtype       'zero', 'mean', 'localmean', 'edge', 'mirror', 'nan' or 'remove'
%   padlength     scalar, number of samples that will be padded
%   prepadlength  scalar, number of samples that will be padded before the data
%   postpadlength scalar, number of samples that will be padded after the data
%
% If padlength is used instead of prepadlength and postpadlength, padding
% will be symmetrical (i.e. padlength = prepadlength = postpadlength)
%
% If the data contains NaNs, these are ignored for the computation, but
% retained in the output. Depend