time | Calls | line |
---|
| | 204 | function s = convertUsingRecycledSprintf(x, d)
|
< 0.001 | 58 | 205 | floatFieldExtra = 7;
|
0.003 | 58 | 206 | f = sprintf('%%%.0f.%.0fg', d+floatFieldExtra, d);
|
| | 207 |
|
< 0.001 | 58 | 208 | [m, n] = size(x);
|
< 0.001 | 58 | 209 | scell = cell(1,m);
|
< 0.001 | 58 | 210 | pads = logical([]);
|
< 0.001 | 58 | 211 | for i = 1:m
|
0.002 | 58 | 212 | scell{i} = sprintf(f,x(i,:));
|
< 0.001 | 58 | 213 | if n > 1 && (min(x(i,:)) < 0)
|
| | 214 | pads(regexp(scell{i}, '([^\sEe])-')) = true;
|
< 0.001 | 58 | 215 | end
|
< 0.001 | 58 | 216 | end
|
| | 217 |
|
< 0.001 | 58 | 218 | s = char(scell{:});
|
| | 219 |
|
< 0.001 | 58 | 220 | pads = find(pads);
|
< 0.001 | 58 | 221 | if ~isempty(pads)
|
| | 222 | pads = fliplr(pads);
|
| | 223 | spacecol = char(ones(m,1)*' ');
|
| | 224 | for pad = pads
|
| | 225 | s = [s(:,1:pad) spacecol s(:,pad+1:end)];
|
| | 226 | end
|
< 0.001 | 58 | 227 | end
|
| | 228 |
|
< 0.001 | 58 | 229 | s = strtrim(s);
|
< 0.001 | 58 | 230 | end
|