Matlab time cell with 1 second interval
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have one problem with date cell, I want the date in 1 second interval:
start_date=06-Jul-2011 15:20:00
end_date=06-August-2011 15:25:00 interval = 1/60/24/60; % 1 second date = datestr(start_date:interval:end_date);
However it is too slow... I think it maybe easy if just by filling in all time with 1 second interval... Is there any other way?
Thanks a lot.
0 件のコメント
採用された回答
Andrei Bobrov
2015 年 3 月 31 日
編集済み: Andrei Bobrov
2015 年 3 月 31 日
start_date='06-Jul-2011 15:20:00'
end_date='06-Aug-2011 15:25:00'
n = datenum({start_date;end_date},'dd-mmm-yyyy HH:MM:SS');
k = floor(diff(n)/(1/24/3600));
n1 = num2cell(datevec(n(1)));
s = datenum(n1{1:5},(0:k)');
out = datestr(s,'dd-mmm-yyyy HH:MM:SS');
2 件のコメント
Andrei Bobrov
2015 年 3 月 31 日
Use
out = datevec(s); % instead of 'out = datestr(s,'dd-mmm-yyyy HH:MM:SS');'
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!