1

如何分隔ddmmyyhhmmss( day, month, year, hour, minute, second) 12 位数字并放在单独的 6 列中MATLAB?我现在总共需要 7 列。例如,我有以下字符串

051210151255 (which is 05 day, 12 month, 2010 year, 15 hours, 12 minute, 55 second)

现在我需要 7 列 ( whole 12 digit number, dd, mm, yy, hh, mm, ss)

4

1 回答 1

0
d = '051210151255';
output = zeros(1, 6);
for i=1:6
   output(1, i) = str2num(d(i*2-1:i*2));
end
output = [str2num(d) output];

给出:

>> output =

     051210151255 5    12    10    15    12    55
于 2013-05-12T22:05:36.400 回答