Borrar filtros
Borrar filtros

formatstring error when using tabularTextDatastore

4 visualizaciones (últimos 30 días)
sani el 17 de Nov. de 2022
Comentada: Jeremy Hughes el 13 de Dic. de 2022

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 ">convertDatatypeToFormatString".

could't find any material on this error online, can someone please advise?


  7 comentarios
Stephen23 el 8 de Dic. de 2022
Editada: Stephen23 el 8 de Dic. de 2022
What MATLAB version and OS are you using? The file works fine here:
ds = tabularTextDatastore('sample file.csv')
ds =
TabularTextDatastore with properties: Files: { '/users/mss.system.JLUjl3/sample file.csv' } Folders: { '/users/mss.system.JLUjl3' } FileEncoding: 'UTF-8' AlternateFileSystemRoots: {} VariableNamingRule: 'modify' ReadVariableNames: true VariableNames: {'BOARD', 'CHANNEL', 'TIMETAG' ... and 3 more} DatetimeLocale: en_US Text Format Properties: NumHeaderLines: 0 Delimiter: ';' RowDelimiter: '\r\n' TreatAsMissing: '' MissingValue: NaN Advanced Text Format Properties: TextscanFormats: {'%f', '%f', '%f' ... and 3 more} TextType: 'char' ExponentCharacters: 'eEdD' CommentStyle: '' Whitespace: ' \b\t' MultipleDelimitersAsOne: false Properties that control the table returned by preview, read, readall: SelectedVariableNames: {'BOARD', 'CHANNEL', 'TIMETAG' ... and 3 more} SelectedFormats: {'%f', '%f', '%f' ... and 3 more} ReadSize: 20000 rows OutputType: 'table' RowTimes: [] Write-specific Properties: SupportedOutputFormats: ["txt" "csv" "xlsx" "xls" "parquet" "parq"] DefaultOutputFormat: "txt"
sani el 8 de Dic. de 2022
I'm using MATLAB 2020a and windows 10 os

Iniciar sesión para comentar.

Respuestas (1)

Jeremy Hughes
Jeremy Hughes el 8 de Dic. de 2022
Editada: Jeremy Hughes el 8 de Dic. de 2022
Turns out this was a bug in R2020a and is been fixed in R2020b. See:
You can work around this with:
ds = tabularTextDatastore('sample file.csv','Delimiter',';','TextscanFormats',"%f%f%f%f%f%q")
ds = tabularTextDatastore('sample file.csv','Delimiter',';','TextscanFormats',"%f%f%f%f%f%x")
  5 comentarios
Jeremy Hughes
Jeremy Hughes el 13 de Dic. de 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
Jeremy Hughes el 13 de Dic. de 2022
The other alternative is to use all %q fields:
ds = tabularTextDatastore('sample file.csv','Delimiter',';','TextscanFormats',"%q%q%q%q%q%q")

Iniciar sesión para comentar.


Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by