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,

 채택된 답변

Steven Lord
Steven Lord 2021년 8월 24일

1 개 추천

Take a look at the stack function.

댓글 수: 1

Tim Starbuck
Tim Starbuck 2021년 8월 24일
Stack did exactly what I needed. Thank you!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Numeric Types에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2021년 8월 24일

댓글:

2021년 8월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by