Clear Filters
Clear Filters

xlsread returning NaNs when reading spreadsheet

3 views (last 30 days)
Hi,
I am using Matlab 2013b and Office 2010. I am reading an excel sheet with the code
[ num, txt, raw ] = xlsread(fullpath, sheets{idx_sheets})
I have looked in both num, txt, and raw but none of those outputs give the complete spreadsheet values. I get a lot of NaN's in parts of the spreadsheet. When I save the spreadsheet to a csv and then save it again as an xls, the code works and I can read all the numbers and strings on the spreadsheet.
Does anyone know of this issue?
Thanks, Horace

Answers (3)

Horace Lai
Horace Lai on 31 Mar 2015
Hi,
Nevermind I found out the issue. There was a hidden sheet in the xlsx. I didn't know you could hide a sheet.
Thanks, Horace

Image Analyst
Image Analyst on 30 Mar 2015
raw should give the actual data. If not, attach your workbook with the paperclip icon and tell us one particular cell (row and column) in your workbook that has good data in it but that the raw array has NaN for.

Horace Lai
Horace Lai on 30 Mar 2015
That's the problem. Raw doesn't seem to have the actual data.
In my xlsx there is one sheet where I have the table format with the data filled in and another sheet with just the table format with no data filled in. Basically the raw shows what the empty sheet looks like, with all the data being shown as NaN
Now I have made sure I am reading the correct sheet. I'm trying to delete some cells to make an example sheet to attach but I noticed that when I try to read the example sheet using the same xlsread code, the output "raw" is the same as before!
Not sure how to continue as I am probably not allowed to share the spreadsheet data.

Community Treasure Hunt

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

Start Hunting!