How can I use the textscan command to read data below a body of text?
1 回表示 (過去 30 日間)
古いコメントを表示
I want to use the textscan(fileID) command to read the data within a .txt file. However, the data begins after about 50 lines of text, and the number of lines of text differs with each .txt file. Can Matlab recognize a "flag" that always occurs before the data?
Example:
Line1;
Line2;
...
Line49;
(Line50)Time,MPitot(V),Static(V),Preston(V),Temperature(K),Voltage,Encoder totcnt,
2014/06/24 15:06:24, 0.242, 4.384, 0.219, 21.18, 8.346, 0,
2014/06/24 15:06:28, 0.242, 4.385, 0.219, 21.23, 8.382, 109,
2014/06/24 15:06:33, 0.242, 4.388, 0.220, 21.02, 8.376, 192,
0 件のコメント
採用された回答
Walter Roberson
2015 年 6 月 29 日
If there is a line before that which is certain to show up and which starts with a known string, then you can use that string together with 'Time' as your CommentStyle parameter.
For example,
These are the voyages of
...
...
Time,MPitot(V),Static(V),Preston(V),Temperature(K),Voltage,Encoder totcnt,
then textscan(fid, LineFormatHere, 'CommentStyle', {'These', 'Time'})
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!