Mercurial > hg > octave-lyh
diff scripts/general/circshift.m @ 10549:95c3e38098bf
Untabify .m scripts
author | Rik <code@nomad.inbox5.com> |
---|---|
date | Fri, 23 Apr 2010 11:28:50 -0700 |
parents | 16f53d29049f |
children | 693e22af08ae |
line wrap: on
line diff
--- a/scripts/general/circshift.m +++ b/scripts/general/circshift.m @@ -55,30 +55,30 @@ sz = size (x); if (! isvector (n) && length (n) > nd) - error ("circshift: n must be a vector, no longer than the number of dimension in x"); + error ("circshift: n must be a vector, no longer than the number of dimension in x"); endif if (any (n != floor (n))) - error ("circshift: all values of n must be integers"); + error ("circshift: all values of n must be integers"); endif idx = cell (); for i = 1:length (n); - nn = n(i); - if (nn < 0) - while (sz(i) <= -nn) - nn = nn + sz(i); - endwhile - idx{i} = [(1-nn):sz(i), 1:-nn]; - else - while (sz(i) <= nn) - nn = nn - sz(i); - endwhile - idx{i} = [(sz(i)-nn+1):sz(i), 1:(sz(i)-nn)]; - endif + nn = n(i); + if (nn < 0) + while (sz(i) <= -nn) + nn = nn + sz(i); + endwhile + idx{i} = [(1-nn):sz(i), 1:-nn]; + else + while (sz(i) <= nn) + nn = nn - sz(i); + endwhile + idx{i} = [(sz(i)-nn+1):sz(i), 1:(sz(i)-nn)]; + endif endfor for i = (length(n) + 1) : nd - idx{i} = 1:sz(i); + idx{i} = 1:sz(i); endfor y = x(idx{:}); endif