Mercurial > hg > octave-lojdl
changeset 14221:b03b15d507d4
accumdim.m: Use common code idiom for finding first non-singleton dimension.
* accumdim.m: Use common code idiom for finding first non-singleton dimension.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 18 Jan 2012 21:17:14 -0800 |
parents | 5a13a75c2457 |
children | 190952239c2c |
files | scripts/general/accumdim.m |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/accumdim.m +++ b/scripts/general/accumdim.m @@ -83,7 +83,8 @@ sz = size (vals); if (nargin < 3) - [~, dim] = max (sz != 1); # first non-singleton dim + ## Find the first non-singleton dimension. + (dim = find (sz > 1, 1)) || (dim = 1); elseif (! isindex (dim)) error ("accumdim: DIM must be a valid dimension"); elseif (dim > length (sz))