Effacer les filtres
Effacer les filtres

Import text as table with multiple delimiter as one

11 vues (au cours des 30 derniers jours)
John Deer
John Deer le 13 Juil 2018
Modifié(e) : John Deer le 17 Juil 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

Réponse acceptée

John Deer
John Deer le 17 Juil 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);

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by