t0=datenum(2013,1,1,0,0,0);
dt = 1/24;
tf=datenum(2013,12,31,23,0,0);
t = t0:dt:TF;
dv = datevec(T);
C=mat2cell(dv(1:end,1:5),ones(length(T),1),5);
s = cell fun(@(t){ sprintf(' % 4 I _ % 02i _ % 02i _ % 02i % 02i _ 02 ',t)},C);
S 1 = cell 2 mat(S);
結果,s是壹個單元格數組,每個元素對應壹個時間;S1是壹個字符矩陣,每行對應壹個時間。