MATLAB Answers

How to sum up over dates?

조회 수: 3(최근 30일)
alpedhuez
alpedhuez 2021년 7월 29일
댓글: Cris LaPierre 2021년 7월 29일
I have table with T
date location sales
--------------------
1/1 NY 100
1/2 NY 105
1/1 LA 70
1/2 LA 90
I want to sum up over dates to create T1 with
1/1 170
1/2 195
What is the next step?
  댓글 수: 1
alpedhuez
alpedhuez 2021년 7월 29일
https://www.mathworks.com/matlabcentral/answers/406864-how-do-i-sum-over-one-dimension-of-a-multidimensional-array

댓글을 달려면 로그인하십시오.

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 7월 29일
편집: Cris LaPierre 2021년 7월 29일
Convert your dates to datetimes and use groupsummary with the groupbins input set to 'day' and your method set to 'sum', and datavars specified as your sales variable. Use the following syntax.
  댓글 수: 13
Cris LaPierre
Cris LaPierre 2021년 7월 29일
See my previous reply. All methods are applied to all datavars.
All your answers can be found by going through the documentation for groupsummary.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by