comparison scripts/general/int2str.m @ 12676:2783fa95cab7

Use common code idiom for creating cell array for indexing ND-arrays * int2str.m, interpft.m, num2str.m, postpad.m, prepad.m, shift.m, fftshift.m, ifftshift.m, unwrap.m
author Rik <octave@nomad.inbox5.com>
date Sun, 15 May 2011 10:50:30 -0700
parents c792872f8942
children c99714aeb008
comparison
equal deleted inserted replaced
12674:9493880928c8 12676:2783fa95cab7
53 n = round (real(n)); 53 n = round (real(n));
54 sz = size(n); 54 sz = size(n);
55 nd = ndims (n); 55 nd = ndims (n);
56 nc = columns (n); 56 nc = columns (n);
57 if (nc > 1) 57 if (nc > 1)
58 idx = cell (); 58 idx = repmat ({':'}, nd, 1);
59 for i = 1:nd
60 idx{i} = 1:sz(i);
61 endfor
62 idx(2) = 1; 59 idx(2) = 1;
63 ifmt = get_fmt (n(idx{:}), 0); 60 ifmt = get_fmt (n(idx{:}), 0);
64 idx(2) = 2:sz(2); 61 idx(2) = 2:sz(2);
65 rfmt = get_fmt (n(idx{:}), 2); 62 rfmt = get_fmt (n(idx{:}), 2);
66 fmt = cstrcat (ifmt, repmat (rfmt, 1, nc-1), "\n"); 63 fmt = cstrcat (ifmt, repmat (rfmt, 1, nc-1), "\n");