How do I use the group summary/unstack function in this script?
조회 수: 1 (최근 30일)
이전 댓글 표시
This is my script:
date1 = datetime(2020,10,12,'Format','yyyy/MM/dd');
date2 = datetime(2020,10,15,'Format','yyyy/MM/dd');
Date = [date1;date1;date1;date2];
Concept = ["Petrol";"Woolworths";"ALDI";"Opal Card"]; T
ype = ["Credit";"Savings";"Cash";"Credit"];
Category = ["Car";"Groceries";"Groceries";"Transportation"]
; Amount = [55;63;15;20];
T = table(Date,Concept,Type,Category,Amount)
It looks like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/382398/image.png)
I am trying to create another table to reflect these results:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/382403/image.png)
I tried using groupsummary function but it would only allow me to use the variables of the columns and not the two dates I need.
Is anyone able to point me in the right direction?
댓글 수: 0
답변 (1개)
Seth Furman
2020년 10월 16일
Take a look at the following documentation example for unstack, which closely resembles your problem.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!