Transpose rows and collums inside a .mat file

Hi,
I've got a 2*8760 excel file that I need to turn in to a 8760*2 .mat file.
I've managed to transpose evry thing by using "file' " and now i have evry thing turn horizontaly in to my command window... But now wat?
Ive only been using matlab (and simulink) for a couple of weeks and my deadline is in 5,5 hours. This cant be a hard thing to do, but i've been stuck on this for hours.
Can't do it in excel becaus of size restrictions, a notpad does'nt seen to do it
_________________________________________________________ >> Tbuiten'
ans =
1.0e+007 *
Columns 1 through 9
0 0.0004 0.0007 0.0011 0.0014 0.0018 0.0022 0.0025 0.0029
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
------------skipping a lot of numbers------------->>>>>>>>>>>>
Columns 8758 through 8760
3.1525 3.1529 3.1532
-0.0000 -0.0000 -0.0000
___________________________________________________________
Screenshot: https://gyazo.com/288ec48daa171bb3c21256b2d2982a45
"Tbuiten" has to look like "Buitentemp"
All help would be verry appreciated!
Koen van Tiel.

 Accepted Answer

"2*8760 excel file that I need to turn in to a 8760*2 .mat file"
SAVE uses strings as its arguments so you can't do the transpose operation inside the command...
x=xlsread('yourfile.xls'); % read excel spreadsheet of numeric values
x=x.'; % transpose in place
save 'yourfile.mat' x % save transposed array as a named file .mat
If you know this is what you're wanting to do, you can save the intermediate step by transposing on reading...
x=xlsread('yourfile.xls').'; % NB: the transpose on the function output
Also will comment that the "'" quote operator is the complex conjugate whereas the geometric array transpose is .' in symmetry with the other "dot" operators that work on an element-by-element basis.
See the doc for details...

More Answers (1)

Dpb, it worked!!!
Thank you very much, I dit have to try a few times and ended up starting a new excel and working from there but it worked!
The save command line didnt seem to work, it dit save the file in to my "current folder" but it doesent allow me to place it in my workspace. I found a work around by just using "x".
Thank you very much!
Koen van Tiel.

Community Treasure Hunt

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

Start Hunting!