필터 지우기
필터 지우기

cumulative sum by hour

조회 수: 2 (최근 30일)
Jonathan Roadley-Battin
Jonathan Roadley-Battin 2017년 7월 3일
답변: Sally Al Khamees 2017년 7월 13일
Good afternoon,
I capture hourly information with regards to usage such that the file appears like:
Name, dd/MM/YY HH:MM, used
ie
jon, 03/07/17 12:00, 1
mark, 03/07/17 12:00, 1
mary, 03/07/17 12:00, 1
jon, 03/07/17 13:00, 1
mary, 03/07/17 13:00, 1
The data is stored in an CSV.
What I would like is to create a cumulative sum per hour
03/07/17 12:00, 3
03/07/17 13:00, 2
two separate fields, timeseries and a summation. The aim is to show usage on a per hour basis (user information is not needed for this. I could brute force an sum on an hourly basis but I am hoping not to resort to an iterative approach.
Is there simpler method to collate such data?

답변 (1개)

Sally Al Khamees
Sally Al Khamees 2017년 7월 13일
Hi Jonathan,
You can read the file into cell arrays and then, use "find" function to get the indices of yourdesired rows and then, use "sum" function for the sum of entries

카테고리

Help CenterFile Exchange에서 Time Series Events에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by