Loading .log data with different number of columns
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all,
I would like to read the following log-file (see: attachment). I used the readtable()-function, but not all data is loaded properly. For instance, not all columns are getting loaded and some text-data is recognised as a Nan.
Do you have any suggestions on how to read the entire file?
Thanks already in advance!
Best,
Sophie
3 commentaires
Réponses (1)
Jon
le 22 Juil 2022
Yes, I would also recommend readcell, so for example
logdata = readcell('Example.log','NumHeaderLines',2)
You could then make another cell array with just the entries corresponding to a specific value occuring in the third column (for some reason the second column of spaces gets read in as missing, but it doesn't really matter) this has values such as 'MAIN', 'TRACK', etc. so for example you could make a cell array of just the entries for 'MAIN' using
mainLog = logdata(strcmp('MAIN',logdata(:,3)),:)
and then turn this into a table using
T = cell2table(mainLog)
and further into a timetable using
TT = table2timetable(T)
From which hopefully you can further extract the information of interest
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with Statistics and Machine Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!