function out = ndbdiagr(varargin)
% bdiag for
%  [2-D  N-D]
%  [N-D  2-D]
%  [N-D  N-D]

% Copyright 2003-2004 The MathWorks, Inc.

if nargin==1
   out = varargin{1};
elseif nargin==2
   a = varargin{1};
   b = varargin{2};
   sza = size(a);
   szb = size(b);
   out = ndvertr(ndhorzr(a,zeros(sza(1),szb(2))), ndhorzr(zeros(szb(1),sza(2)),b));
else
   out = ndbdiagr(ndbdiagr(varargin{1},varargin{2}),varargin{3:end});
end
