Borrar filtros
Borrar filtros

Import text as table with multiple delimiter as one

16 visualizaciones (últimos 30 días)
John Deer
John Deer el 13 de Jul. de 2018
Editada: John Deer el 17 de Jul. de 2018
In want to import text from a logfile into a table with two columns. The delimiter should be '()'
Example:
T4 10:14:9 Class.Function() Patches were moved by 45.2206nm (max), 12.1091nm (mean)
Using the import-wizard and specifying the Column delimiters as custom and () everything works fine.
After some while i found a code-solution that works close to that what i want to have:
table = readtable(FilePath, 'Delimiter', '()' ,'MultipleDelimsAsOne',1);
But the problem is, that this delimits the text with the multiple delimiter AND the single delimiters as well, causing problems on the above example at (max) and (mean).
Are there some more sideconditions for readtable to prevent this? Thanks

Respuesta aceptada

John Deer
John Deer el 17 de Jul. de 2018
I found out a solution on my own:
You have to specify the delimiter as a cell-array:
Delim = {'()'};
table = readtable(SourcePath, 'Delimiter', Delim ,'MultipleDelimsAsOne',1);

Más respuestas (0)

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by