I have data for five different years, I need to separate each year separately? what's the best possible way? I tried using datnum command..
7 次查看(过去 30 天)
显示 更早的评论
displaytime = datenum(time)-732313 I used this code and it gives me the data for all five years but I need the data for each year separately.
2 个评论
KSSV
2015-10-16
on what variable name the data is stored? Data you mean, it is in a text file? If so, what is the name of text file? You have to be more lcear about how the data is.
采纳的回答
Ingrid
2015-10-16
编辑:Ingrid
2015-10-16
you should not use datenum but datevec as then the year is stored in the first column
timeVector =datevec(time);
timeYear = timeVector(:,1);
possibleYears = unique(timeYear);
datePerYear = cell(numel(possibleYears));
for ii = possibleYears
datePerYear{ii} = time(timeYear ==ii);
end
0 个评论
更多回答(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!