Reputation: 67
I want to read xlsx file in matlab. xlsx file contains numeric and non numeric (string) variables. When I try to read file by xlsread(filename)
, non-numeric variables are seen like NaN
. I mean;
my xlsx files like;
13 96 partly cloudy
12 98 clear
13 99 clear
14 97 partly cloudy
but when I read by xlsread(filename)
, the values appear like below;
13 96 Nan
12 98 Nan
13 99 Nan
14 97 Nan
How to I read all type of values and assign a variable from xlsx file in matlab?
Upvotes: 0
Views: 1504
Reputation: 7817
With one output, xlsread
only returns the numeric data. Instead, you should do this:
[~, ~, data] = xlsread(filename);
It will return a cell array containing all the contents of the file (the first two outputs, ignored here using ~
, are just the numeric contents, and just the text contents)
Upvotes: 1