How to pivot a table?

7 Ansichten (letzte 30 Tage)
Tim Starbuck
Tim Starbuck am 24 Aug. 2021
Kommentiert: Tim Starbuck am 24 Aug. 2021
I am trying to pivot a table in matlab so that I can upload it into a database.
The current data set mimics the following:
Column1 Column2 Column3 08-2021 09-2021 10-2021
ABC 123 !!!!!! 100 100 100
ABC 456 ???? 200 100 50
ABC 789 &&& 300 10 150
The desired result would to pivot the date columns to rows and have the other columns repeat. I can do this i a couple other programs so I'm sure there is probably a command in matlab to do it, but I just dont know it.
Column1 Column2 Column3 Date Value
ABC 123 !!!!!! 08-2021 100
ABC 123 !!!!!! 09-2021 100
ABC 123 !!!!!! 10-2021 100
ABC 456 ???? 08-2021 200
ABC 456 ???? 09-2021 100
ABC 456 ???? 10-2021 50
ABC 789 &&& 08-2021 300
ABC 789 &&& 09-2021 10
ABC 789 &&& 10-2021 150
Thank you,

Akzeptierte Antwort

Steven Lord
Steven Lord am 24 Aug. 2021
Take a look at the stack function.
  1 Kommentar
Tim Starbuck
Tim Starbuck am 24 Aug. 2021
Stack did exactly what I needed. Thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by