Combine multiple columns into a single column keeping the column names?

6 ビュー (過去 30 日間)
Angelavtc 2021 年 9 月 29 日
コメント済み: Angelavtc 2021 年 10 月 1 日
Dear all,
I have a matrix with dimensions 24*366. Each row corresponds to a time in the day (hour 1 to hour 24) and each column to a year's day (01-Jan-2020 to 31-Dec-2020). How do I convert the multiple columns to a single column? Also, I want to create a new column with the date that each cell corresponds to. I have seen in the forum that to transform multiple columns into one I can do:
A=[ 1 2 3 4
5 6 7 8
9 1 2 3]
However, the date ID column is essential, and I don't know how to get it. I have attached a picture of a simple example of what I want.
Thank you in advance!
  6 件のコメント
Angelavtc 2021 年 10 月 1 日
@the cyclist Thank you, it worked! I wrote the following code:
t = readtable('Spot2020.xlsx','PreserveVariableNames',true);
I am sorry for not showing the excel file before. I am attaching an small example. However, I have the solution. Thank you, again!


回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by