Monthly turnover where I need the sum

1 回表示 (過去 30 日間)
Martin
Martin 2019 年 7 月 17 日
回答済み: Steven Lord 2019 年 7 月 17 日
Hi, I have a x 2 table like this:
Rows can vary from 1:inf.
I need sum of the monthly Turnover (2. column) from timestamp (1. column) (last row is latest time and the "anchored" timestamp - means i need turnover 1 month prior that latest time in the bottom). Anyone know a way out of this? Keep in mind if there is no full month in 1. column (there could be only, say, 3 rows) then I need the sum of it all.

回答 (1 件)

Steven Lord
Steven Lord 2019 年 7 月 17 日
If all the entries in the Time variable in your table were valid date strings that datetime could understand, I would first convert that variable into a datetime array. Next I would call table2timetable to make a timetable from the table. Finally I would call retime or groupsummary on that timetable.
As shown the Time variable in the table contains at least one element that datetime will not be able to understand: 'Start'. Can you remove that or replace it with the actual starting time for your data set? If so you could try the process I described.

カテゴリ

Help Center および File ExchangeTimetables についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by