annotate toolboxes/FullBNT-1.0.7/KPMtools/num2strcell.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function c = num2strcell(n, format)
wolffd@0 2 % num2strcell Convert vector of numbers to cell array of strings
wolffd@0 3 % function c = num2strcell(n, format)
wolffd@0 4 %
wolffd@0 5 % If format is omitted, we use
wolffd@0 6 % c{i} = sprintf('%d', n(i))
wolffd@0 7
wolffd@0 8 if nargin < 2, format = '%d'; end
wolffd@0 9
wolffd@0 10 N = length(n);
wolffd@0 11 c = cell(1,N);
wolffd@0 12 for i=1:N
wolffd@0 13 c{i} = sprintf(format, n(i));
wolffd@0 14 end
wolffd@0 15
wolffd@0 16