load a file and sort out bad data.
古いコメントを表示
I have a text file like shown below, that I want to load in to matlab. The format of the file should be like: [temp rate type], but if some of the data is not in correct format i want them sorted out. For example a file could look like this:
25 0.109 1
corrupted line
20 0.096 2
100 0 3
15 0.517 3
15 0.8 5
35 1.086 4
3
40 0.934 2
3 3 3 3 3 3
35 0.109 1
22 0.100 1
21 0.100 2
16 0.600 3
17 0.850 5
32 1.080 4
45 0.950 2
37 0.110 1
Any letters and lines that are not in correct format ( 3 numbers per line) should be ignored, when loading the file. How can I do this? I have tried different combinations of fgetl(), scanf(), and textscan(), but I am not sure how to do it. Please help me if you can.
Adam
採用された回答
その他の回答 (1 件)
1 件のコメント
Jason Nicholson
2014 年 6 月 17 日
Your welcome.
カテゴリ
ヘルプ センター および File Exchange で Shifting and Sorting Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!