How to filter out missing data from a text file with readtable()? Different data types in the same column.
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
dpb
2019 年 5 月 28 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!