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: catuneven.m
    path of file: ./repos/CanlabCore/CanlabCore/External/boundedline/catuneven
    
    the code of the file until where you have to start completion: function b = catuneven(dim, padval, varargin)

    
function b = catuneven(dim, padval, varargin)
%CATUNEVEN Concatenate unequally-sized arrays, padding with a value
%
% This function is similar to cat, except it does not require the arrays to
% be equally-sized along non-concatenated dimensions.  Instead, all arrays
% are padded to be equally-sized using the value specified.
%
% b = catuneven(dim, padval, a1, a2, ...)
%
% Input variables:
%
%   dim:    dimension along which to concatenate
%
%   padval: value used as placeholder when arrays are expanded
%
%   a#:     arrays to be concatenated, numerical
%
% Output variables:
%
%   b:      concatenated array

% Copyright 2013 Kelly Kearney

ndim = max(cellfun(@ndims, varargin));
ndim = max(ndim, dim);

for ii = 1:ndim
    sz(:,ii) = cellfun(@(x) size(x, ii), varargin);
end