MATLAB Answers


Read each columns of xls,csv,... as a matrix

Asked by Mtlb Usr on 31 Jan 2011
I have got a several CSV and XLS files and I want to read with a MATLAB wizard to read each column as a matrix.
I have tried it with these files and only I got it with csv file.
What is the rule for read these files in this way?


What is happening when you fail? When you say "read as a matrix" do you mean "read as a vector"?
Exactly, when I said "read as a matrix" I would want to say " a vector".

Sign in to comment.

3 Answers

Answer by the cyclist
on 2 Feb 2011

Are you using a Mac? Macs can't read Excel files:

  1 Comment

XLSREAD is able to read Excel file also on MAC OS. You won't obtain all the functionalities related to the COM (that's available only on Windows OS) but you will still be able to read the file in basic mode.

Sign in to comment.

Answer by Mtlb Usr on 3 Feb 2011

I'm not using a Mac.


Sign in to comment.

Answer by Davide Ferraro on 3 Feb 2011

To read an Excel file you should use XLSREAD:
The syntax:
[num,txt,raw] = xlsread(filename,range)
allows you to select a specific range. This should be a string with the same format you would use in Excel (e.g. 'B2:B8' to read from cell B2 to cell B8).


Sign in to comment.