comparison scripts/signal/ifftshift.m @ 7208:a730e47fda4d

[project @ 2007-11-28 02:32:41 by jwe]
author jwe
date Wed, 28 Nov 2007 02:32:42 +0000
parents a1dbe9d80eee
children cadc73247d65
comparison
equal deleted inserted replaced
7207:71c03c7239fb 7208:a730e47fda4d
37 if (nargin != 1 && nargin != 2) 37 if (nargin != 1 && nargin != 2)
38 print_usage (); 38 print_usage ();
39 endif 39 endif
40 40
41 if (nargin == 2) 41 if (nargin == 2)
42 if (!isscalar (dim)) 42 if (! isscalar (dim))
43 error ("ifftshift: dimension must be an integer scalar"); 43 error ("ifftshift: dimension must be an integer scalar");
44 endif 44 endif
45 nd = ndims (V); 45 nd = ndims (V);
46 sz = size (V); 46 sz = size (V);
47 sz2 = floor (sz(dim) / 2); 47 sz2 = floor (sz(dim) / 2);
48 idx = cell (); 48 idx = cell ();
49 for i=1:nd 49 for i=1:nd
50 idx {i} = 1:sz(i); 50 idx{i} = 1:sz(i);
51 endfor 51 endfor
52 idx {dim} = [sz2+1:sz(dim), 1:sz2]; 52 idx{dim} = [sz2+1:sz(dim), 1:sz2];
53 retval = V (idx{:}); 53 retval = V (idx{:});
54 else 54 else
55 if (isvector (V)) 55 if (isvector (V))
56 x = length (V); 56 x = length (V);
57 xx = floor (x/2); 57 xx = floor (x/2);