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: zpad.m
    path of file: ./repos/bspm/thirdparty/brainwavelet_v1.1_fMRI_OSX/BWT
    
    the code of the file until where you have to start completion: function outmat = zpad(inmat,dim,lvl)
%
% FUNCTION:     zpad    -- Pads zeros to input 3-D matrix in x,y or z 
%                          direction.
%                            
% USAGE:        outmat = zpad(inmat,dim,lvl)
%
% Inputs:       inmat   -- 3-D matrix input for zero padding.
%               dim     -- Dimension for circularizing. Input must be a
%                          string. Valid dimensions: 'x','y','z'.
%               lvl     -- Pad level - how many columns to zeros to pad.
%
% Output:       outmat  -- Zero-padded matrix.
%
% EXAMPLE:      output = zpad(3Dmat,'x',2)
%               
%               3Dmat (:,:,1)   = [a b . . . . . c d]    
%                                 [a b . . . . . c d]
%                                 [a b . . . . . c d]
%                                 [a b . . . . . c d]    

    
function outmat = zpad(inmat,dim,lvl)
%
% FUNCTION:     zpad    -- Pads zeros to input 3-D matrix in x,y or z 
%                          direction.
%                            
% USAGE:        outmat = zpad(inmat,dim,lvl)
%
% Inputs:       inmat   -- 3-D matrix input for zero padding.
%               dim     -- Dimension for circularizing. Input must be a
%                          string. Valid dimensions: 'x','y','z'.
%               lvl     -- Pad level - how many columns to zeros to pad.
%
% Output:       outmat  -- Zero-padded matrix.
%
% EXAMPLE:      output = zpad(3Dmat,'x',2)
%               
%               3Dmat (:,:,1)   = [a b . . . . . c d]    
%                                 [a b . . . . . c d]
%                                 [a b . . . . . c d]
%                                 [a b . . . . . c d]    
%
%               output (:,:,1)  = [0 0 a b . . . . . c d 0 0]
%                                 [0 0 a b . . . . . c d 0 0]
%                                 [0 0 a b . . . . . c d 0 0]
%                                 [0 0 a b . . . . . c d 0 0]
%
% AUTHOR:       Ameera X Patel
% CREATED:      29-12-2013
%   
% CREATED IN:   MATLAB 7.13
%
% REVISION:     3
%
% COPYRIGHT:    Ameera X Patel (2013, 2014), University of Cambridge
%
% TOOLBOX:      BrainWavelet Toolbox v1.1

% ID: zpad.m 3 30-01-2014 BWTv1.1 axpatel


%% check inputs

fname=mfilename;
if nargin<1
    help(fname); return
end