diff scripts/general/blkdiag.m @ 5552:bcc328604953

[project @ 2005-11-30 05:48:59 by jwe]
author jwe
date Wed, 30 Nov 2005 05:48:59 +0000
parents 71cfd8fedd5d
children f7b4dfd541d1
line wrap: on
line diff
--- a/scripts/general/blkdiag.m
+++ b/scripts/general/blkdiag.m
@@ -32,22 +32,21 @@
     usage ("blkdiag (a, b, c, ...)");
   endif
 
-  # isnumeric is not an option for cellfun
   if (! all (cell2mat (cellfun (@isnumeric, varargin))))
-    error ("all of the arguments to blkdiag must be numeric");
+    error ("blkdiag: all arguments must be numeric");
   endif
 
-  # ndims is, so it's used here for speed
-  # note: trailing singletons are automatically (correctly) ignored
-  if (! all (cellfun ("ndims", varargin) == 2))
+  ## Note: trailing singletons are automatically (correctly) ignored.
+  if (! all (cellfun (@ndims, varargin) == 2))
     error ("all of the arguments to blkdiag must be two-dimensional matrices");
   endif
 
-  # ignore empty matrices
-  notempty = ! cellfun ("isempty", varargin);
+  ## Ignore empty matrices.
+  notempty = ! cellfun (@isempty, varargin);
   varargin = varargin(notempty);
 
-  # size is, but it's a bit different from calling size directly
+  ## size is an option for cellfun, but it's a bit different from
+  ## calling size directly.
   csz = cumsum ([0 0; (cell2mat (cellfun (@size, varargin')))], 1);
   retval = zeros (csz(end,:));
   for p = 1:(length (notempty(notempty)))