Mercurial > octave
diff scripts/general/postpad.m @ 12674:9493880928c8
Use common idiom in m-files for finding first non-singleton dimension.
* flipdim.m, postpad.m, prepad.m, shift.m, unwrap.m: Use common idiom in
m-files for finding first non-singleton dimension.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 15 May 2011 08:58:49 -0700 |
parents | 4d777e05d47c |
children | 2783fa95cab7 |
line wrap: on
line diff
--- a/scripts/general/postpad.m Sun May 15 07:39:01 2011 -0700 +++ b/scripts/general/postpad.m Sun May 15 08:58:49 2011 -0700 @@ -53,11 +53,8 @@ nd = ndims (x); sz = size (x); if (nargin < 4) - ## Find the first non-singleton dimension - dim = find (sz > 1, 1); - if (isempty (dim)) - dim = 1; - endif + ## Find the first non-singleton dimension. + (dim = find (sz > 1, 1)) || (dim = 1); else if (!(isscalar (dim) && dim == fix (dim)) || !(1 <= dim && dim <= nd))