formatstring error when using tabularTextDatastore
Afficher commentaires plus anciens
Hello all,
I am trying to read a large CSV file (~500GB) using tabularTextDatastore.
my command line is just one:
ds = tabularTextDatastore('filename.csv')
the error I'm getting is:
Error using tabularTextDatastore (line 147)
Output argument "formatString" (and maybe others) not assigned duting call to "matlab.io.internal.text.determineFormatString>convertDatatypeToFormatString".
could't find any material on this error online, can someone please advise?
thanks!
7 commentaires
Jeremy Hughes
le 17 Nov 2022
If you can share a sample version of the file which reproduces the error, that would help. Also what version are you using?
sani
le 22 Nov 2022
Jeremy Hughes
le 8 Déc 2022
Déplacé(e) : Stephen23
le 8 Déc 2022
Without a sample file, anyone that might know how to help cannot reproduce the issue—this is probably why no one has responded. You'll have better luck getting help by adding an example file along with the code sample which reproduces the issue.
The code is there, but the file is an integral part of the reproduction. It doesn't have to be the exact file as long as you see the same issue. Try copying the first few lines of the file and see if that file still reproduces the issue.
I'd also suggest trying this same reproduction on another installation, on another machine. Sometimes these kinds of errors coming from MathWorks written code is due to files that are missing which should be available, or additional files on the path which are shadowing standard MathWorks functions. I'm not sure that's the case here, but I can't really try to reproduce it.
The second possibility is a bug in the existing code, which is being uncovered with this specific file, and we'd need to understand what's happening in order to fix it.
Without that file, they might be guessing at the content to try to reproduce it, but if they can't figure that out then they aren't likely to continue.
What MATLAB version and OS are you using? The file works fine here:
ds = tabularTextDatastore('sample file.csv')
sani
le 8 Déc 2022
Réponses (1)
Jeremy Hughes
le 8 Déc 2022
Modifié(e) : Jeremy Hughes
le 8 Déc 2022
Turns out this was a bug in R2020a and is been fixed in R2020b. See: https://www.mathworks.com/support/bugreports/2263913
You can work around this with:
ds = tabularTextDatastore('sample file.csv','Delimiter',';','TextscanFormats',"%f%f%f%f%f%q")
or
ds = tabularTextDatastore('sample file.csv','Delimiter',';','TextscanFormats',"%f%f%f%f%f%x")
5 commentaires
Jeremy Hughes
le 8 Déc 2022
Acutally the fix should be in R2020a Update 4. Check to see if you can update to that version.
sani
le 13 Déc 2022
sani
le 13 Déc 2022
Jeremy Hughes
le 13 Déc 2022
This looks like a separate issue with the format of the file not matching the expected format. You'll need to check the contents match on each row. If the rows aren't consistent with each other, then you might need to clean up the file to work with tabularTextDatastore.
If you're reading one file, then try readtable.
Jeremy Hughes
le 13 Déc 2022
The other alternative is to use all %q fields:
ds = tabularTextDatastore('sample file.csv','Delimiter',';','TextscanFormats',"%q%q%q%q%q%q")
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!