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
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.
Dayne Davey
Dayne Davey 2015-10-19
Okay !! I have five years of data for time for each day of the year, so basically 365*5 columns of data (if that makes sense) I need to separate each year of data separately. for example, I have the data for year 2000,2001,2002,2003 and 2004. I need to create a code to separate them individually.

请先登录,再进行评论。

采纳的回答

Ingrid
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 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by