How to reorder monthly row data into one column?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Elizabeth Lees
am 17 Nov. 2020
Kommentiert: Ameer Hamza
am 17 Nov. 2020
I have a dataset in csv format which is formatted in yearly rows containing a value for each month (13 values total per row, first one being the year then followed by each month). I'd like to transpose this data into one long column of only the monthly values. I believe a loop might work but unsure how to apply it. Any help would be greatly apprciated.
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 17 Nov. 2020
Bearbeitet: Ameer Hamza
am 17 Nov. 2020
Following assume variable M is n*13 matrix from csv file
M = readmatrix('filename.csv');
M_data = M(:,2:end); % exclude the years column
M_linear = reshape(M_data.', [], 1)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!