MATLAB Answers

Reformatting columns and rows of a table

13 views (last 30 days)
alpedhuez
alpedhuez on 23 Jan 2021
Commented: Star Strider on 23 Jan 2021
Suppose I have a table
date NY Chicago SF
---------------------------
1/1/2020 10 15 20
1/2/2020 15 20 10
I want to reformat a table into the form
date city
-----------------------
1/1/2020 NY 10
1/2/2020 NY 15
1/1/2020 Chicago 15
1/2/2020 Chicago 20
Please advise.

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 23 Jan 2021
Perhaps stack? Otherwise unstack? (Not clear on the result you want.)

  4 Comments

Show 1 older comment
Star Strider
Star Strider on 23 Jan 2021
One of those functions will likely work.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!