diff scripts/general/common_size.m @ 10965:28ef5a31763d

small rewrite in common_size
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 13 Sep 2010 08:32:25 +0200
parents 693e22af08ae
children 4cb1522e4d0f
line wrap: on
line diff
--- a/scripts/general/common_size.m
+++ b/scripts/general/common_size.m
@@ -71,13 +71,9 @@
         scal = !nscal;
         varargout = varargin;
         if (any (nscal))
-          ## This could also be achieved by cellfun (@repmat, ...), but repmat is an
-          ## m-function and hence still carries interpreter overhead. Further,
-          ## cellfun is slightly optimized for the case used below.
-          uo = "uniformoutput";
           dims = size (varargin{find (nscal, 1)});
-          subs = substruct ("()", arrayfun (@ones, 1, dims, uo, false));
-          varargout(scal) = cellfun ("subsref", varargin(scal), {subs}, uo, false);
+          subs = arrayfun (@ones, 1, dims, "uniformoutput", false);
+          varargout(scal) = cellindexmat (varargin(scal), subs{:});
         endif
       endif
     endif