How to locate character string in a csv file and skip it
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I'm reading a csv file, however, somewhere in the file, (unknown location, so the row, column for this character), an unrecognizable or non-numeric character string (for example, Fö£a´]=Õê´‡X¼Ð, which is generated by binary to ascii conversion process) will be encountered, so the format specification in textscan cannot be used (because of the unknown location). So I saw the error in the following. Is there any way to use textscan or even csvread to process this kind of csv file, without compromising the speed? Many thanks.
"Mismatch between file and format string.
Trouble reading 'Numeric' field from file (row number 1096608,
field number 110) ==> Fö£a´]=Õê´‡X¼Ð , , , ,$, , , , , , , , ,
, , , , , , , , , , , , , , , \n
Error in LoadDumpDataCSV_V2 (line 53)
dataArray = textscan(fileID, formatSpec, 'Delimiter',
',', 'MultipleDelimsAsOne', false, 'ReturnOnError',
false);
4 comentarios
Guillaume
el 17 de Jun. de 2016
If the file starts as binary, why not parse it as such rather than have an expensive binary to text conversion and an expensive parsing afterward?
Tina Zhao
el 17 de Jun. de 2016
Editada: Walter Roberson
el 17 de Jun. de 2016
Respuestas (0)
Ver también
Categorías
Más información sobre Text Files 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!