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: adimat_padarray.m
    path of file: ./repos/d2d/arFramework3/ThirdParty/StrucID/adimat/runtime
    
    the code of the file until where you have to start completion: % function z = adimat_padarray(z, padcnt)
%
% Successively pad array z with padcnt(dim) slices of zeros along each
% dimension dim
    
function z = adimat_padarray(z, padcnt)
%
% Successively pad array z with padcnt(dim) slices of zeros along each
% dimension dim.
%
% This file is part of the ADiMat runtime environment
%
% Copyright 2013 Johannes Willkomm, Institute for Scientific Computing
%                     TU Darmstadt
function z = adimat_padarray(z, padcnt)
  for dim=1:length(size(padcnt))
    sz = size(z);
    sz(dim) = padcnt(dim);
    padding = zeros(sz);
    z = cat(dim, z, padding);
  end