How do I transpose numerical and text data in excel from columns to rows?

조회 수: 7 (최근 30일)
dbrad
dbrad 2019년 11월 22일
댓글: Bob Thompson 2019년 11월 22일
Hi all,
I have an excel spreadsheet that has numerical and text data writen both column wise and row wise. Using matlab, my task is to read and rewrite the spreadsheet so that it all will read column wise. The columns in green are acceptable. The blue columns must be transposed to read as a row and moved up one row.
task.PNGCurrently, I already have the file imported and can read the data using [n,t,r]. I'm guessing the next steps are to change the table to arrays and work from there?
Thanks!
  댓글 수: 1
Bob Thompson
Bob Thompson 2019년 11월 22일
I don't entire understand how your final data will be structured, would you mind explaining that a bit more?
That being said, I would suggest splitting the final column off from the rest of the data. If the first four columns are fine, then you can just write them back out with xlswrite, but you might want to write the final column as a separate command.
Transposing matrices in MATLAB can be accomplished with '.
>> A = [1 2 3];
>> A'
ans =
1
2
3
This should also work for cell matrices, or whatever class you have. Tables might be more interesting, but I would imagine the process would be similar.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by