comparison scripts/signal/fftshift.m @ 8507:cadc73247d65

style fixes
author John W. Eaton <jwe@octave.org>
date Tue, 13 Jan 2009 14:08:36 -0500
parents a730e47fda4d
children eb63fbe60fab
comparison
equal deleted inserted replaced
8506:bc982528de11 8507:cadc73247d65
57 endif 57 endif
58 nd = ndims (V); 58 nd = ndims (V);
59 sz = size (V); 59 sz = size (V);
60 sz2 = ceil (sz(dim) / 2); 60 sz2 = ceil (sz(dim) / 2);
61 idx = cell (); 61 idx = cell ();
62 for i=1:nd 62 for i = 1:nd
63 idx{i} = 1:sz(i); 63 idx{i} = 1:sz(i);
64 endfor 64 endfor
65 idx{dim} = [sz2+1:sz(dim), 1:sz2]; 65 idx{dim} = [sz2+1:sz(dim), 1:sz2];
66 retval = V (idx{:}); 66 retval = V (idx{:});
67 else 67 else
72 elseif (ismatrix (V)) 72 elseif (ismatrix (V))
73 nd = ndims (V); 73 nd = ndims (V);
74 sz = size (V); 74 sz = size (V);
75 sz2 = ceil (sz ./ 2); 75 sz2 = ceil (sz ./ 2);
76 idx = cell (); 76 idx = cell ();
77 for i=1:nd 77 for i = 1:nd
78 idx{i} = [sz2(i)+1:sz(i), 1:sz2(i)]; 78 idx{i} = [sz2(i)+1:sz(i), 1:sz2(i)];
79 endfor 79 endfor
80 retval = V (idx{:}); 80 retval = V (idx{:});
81 else 81 else
82 error ("fftshift: expecting vector or matrix argument"); 82 error ("fftshift: expecting vector or matrix argument");