Splitting data based on daynumber and get the belonging rows
2 ビュー (過去 30 日間)
古いコメントを表示
I have a dataset with datenum values in one column and another column with numbers(counts). The datenum values are the date + time. I need to calculate certain values per day and afterwards per specific timeframe in a day. I have been able to split this data by day using the following code:
TimeData = (:,1);
CountsData = (:,2);
TimeDataDay = datevec(TimeData);
TimeDataDay = TimeDataDay (:,1:3); %only return the date
UniqueDate = unique(TimeDataDay);
DataDay = [TimeDataDay, CountsData] %returns only date vs counts
DataDay1 = UniqueDate(1,:)
[row,~] = find(DataDay == DateDay1)
DataD1 = DataDay(row,:);
So now DataD1 is the date vs the counts. It does not display the time. However, I need to get the date + time vs the time. Is there a way to do this?
3 件のコメント
Guillaume
2018 年 5 月 15 日
Which version of matlab are you using? Any reason you're not using modern tools such as timetable, and possibly discretize, splitapply, etc.?
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Time Series Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!