Datastore can't convert variable to type double
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a collection of excel sheets in a folder which all have the same formatting etc. I called spreadsheetDatastore on it, then created a tall array. However, it seems like there is a problem with the read functionality.
ds = spreadsheetDatastore('J:\Fixed _Inc\Internal\birtanderin\MS Data\25-35\*.xlsx');
tt = tall(ds);
s = size(tt.Coupon);
I get the following error:
Error using tall/gather (line 50)
Internal problem while evaluating tall expression. The problem was:
Unable to convert variable 'Coupon' in sheet 'Sheet4' in file 'J:\Fixed _Inc\Internal\birtanderin\MS Data\25-35\2007.xlsx' to type
'double'.
Learn more about errors encountered during GATHER.
Error in database_build (line 20)
size = gather(s);
Caused by:
Unable to convert variable 'Coupon' in sheet 'Sheet4' in file 'J:\Fixed _Inc\Internal\birtanderin\MS Data\25-35\2007.xlsx' to
type 'double'.
When I checked ds to see the variable type of 'Coupon', it says double, so I don't understand why Matlab gives me error trying to convert a type double variable to type double.
The weirdest thing is, if I try the same code on small dataset (52 rows), it works perfectly. This only seems to be a problem with a large dataset. Please help.
0 Commenti
Risposte (1)
Steven Lord
il 8 Giu 2018
Look at sheet Sheet4 in the file 'J:\Fixed _Inc\Internal\birtanderin\MS Data\25-35\2007.xlsx'. Does it have something that can't be converted into a number in the Coupon column? Maybe whatever wrote that sheet accidentally put text in that column instead of a number (perhaps by omitting one of the previous columns, thereby putting whatever should have been in the next column into Coupon instead.)
Vedere anche
Categorie
Scopri di più su Data Type Conversion in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!