diff scripts/general/flipdim.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 fd0a3ac60b0e
children 9e7ebbaf69ff
line wrap: on
line diff
--- a/scripts/general/flipdim.m	Sun May 15 07:39:01 2011 -0700
+++ b/scripts/general/flipdim.m	Sun May 15 08:58:49 2011 -0700
@@ -45,7 +45,7 @@
   nd = ndims (x);
   if (nargin == 1)
     ## Find the first non-singleton dimension.
-    [~, dim] = min (size (x) != 1);
+    (dim = find (sz > 1, 1)) || (dim = 1);
   elseif (! (isscalar (dim) && isindex (dim)))
     error ("flipdim: DIM must be a positive integer");
   endif