How do I use the group summary/unstack function in this script?

2 ビュー (過去 30 日間)
Mila Bojovic
Mila Bojovic 2020 年 10 月 15 日
回答済み: Seth Furman 2020 年 10 月 16 日
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
I am trying to create another table to reflect these results:
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?

回答 (1 件)

Seth Furman
Seth Furman 2020 年 10 月 16 日
Take a look at the following documentation example for unstack, which closely resembles your problem.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by