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,

 Respuesta aceptada

Steven Lord
Steven Lord el 24 de Ag. de 2021

1 voto

Take a look at the stack function.

1 comentario

Tim Starbuck
Tim Starbuck el 24 de Ag. de 2021
Stack did exactly what I needed. Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2020b

Preguntada:

el 24 de Ag. de 2021

Comentada:

el 24 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by