How to filter out missing data from a text file with readtable()? Different data types in the same column.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to use readtable() to read this textfile I have, however the textfile has one column that has different types of data within it. The database I got the data from is supposed to give me a number for every hour of every day, but if there was no data recorded at a certain time insted of a floating point number it will have a char "M".
What is the best way for me to import this text file using readtable()? I need the information from the second and third columns, but I do not want the rows that have M as a value for the third column.
Here is an example of my data:
MKE,2008-07-08 05:52,4.83
MKE,2008-07-08 06:52,0.51
MKE,2008-07-08 07:52,M
MKE,2008-07-08 08:52,M
0 commentaires
Réponses (1)
dpb
le 28 Mai 2019
Use the 'TreatAsEmpty' named argument to read the M lines as empty and will return NaN. Then just delete the rows that return isnan() == T.
0 commentaires
Voir également
Catégories
En savoir plus sur Text Files 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!