Sanuuu
Sanuuu

Reputation: 243

Cannot read from an xls file (MATLAB)

I'm trying to read data from a xls file using

[a,b,c]=xlsread('list.xls', 1, 'A1:C5')

but as the result I get all a, b and c empty, even though there is data in the list.xls spreadsheet at the specified range. What might be the problem?

Upvotes: 0

Views: 648

Answers (1)

fpe
fpe

Reputation: 2750

From http://www.mathworks.com/help/matlab/ref/xlsread.html:

[num,txt,raw] = xlsread(___)

additionally returns the text fields in cell array txt, and the unprocessed data (numbers and text) in cell array raw using any of the input arguments in the previous syntaxes. If xlRange is specified, leading blank rows and columns in the worksheet that precede rows and columns with data are returned in raw.

If you are only interested in data (numbers), you may type

xlsread(filename,1,'A1:C5')

If you have headers on the first row, call

[num,txt,raw] = xlsread(___)

num: array containing data;

txt: cell containing headers;

raw: cell containing headers and data.

I hope this helps

Upvotes: 2

Related Questions