How to pivot a table?
Show older comments
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,
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!