Reading from a large excel sheet using xlsread, I am trying to read data and find numerical values assigned to specific lines in the data sheet. Part of the data sheet looks like this:
The code I am using is:
[numbers,strings,raws]=xlsread(FileName);
iHeight=find(strcmp(raws,'Height'))
ShowRaws=raws(iHeight,3:end)
height=cell2mat(raws(iHeight,3:end))
But after running it I get the following results:
iHeight=find(strcmp(raws,'Height'))
iHeight =
1
ShowRaws =
1×10 cell array
Columns 1 through 6
{'cm'} {[NaN]} {[62.29]} {[68.5]} {[73.8]} {[83.81]}
Columns 7 through 10
{[70.43]} {[70.57]} {[71.06]} {[109.88]}
And for thew last line:
height=cell2mat(raws(iHeight,3:end))
I get the error message:
Error using cell2mat (line 45)
All contents of the input cell array must be of the same data type.
Error in CompareDataBases (line 12)
height=cell2mat(raws(iHeight,3:end))
Here I am trying to read the value "height" knowing where the title appears, but the raw format data cannot be converted to numeric because obviously not all the data values in the loaded array are of the ame format. It also looks like the '-' symbol in the excel sheet has not even been read.
How can I overcome this prbolem?
0 Comments
Sign in to comment.