フィルターのクリア

How to skip randomly occurring header lines using textscan

1 回表示 (過去 30 日間)
Par
Par 2011 年 12 月 20 日
Hello,
I wish to use textscan to read a large text file have two tab separated numbers in each line. The problem is, once in a while, the file has a header line beginning with a '>' character. How do I use textscan to read the file skipping the header lines whenever they occur? I tried using fgetl and the code has been running for several hours and is still running! I know textscan will do it in seconds. If anybody knows a solution, please help.

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 20 日
Provided that the '>' does not occur otherwise, use 'CommentStyle', '>' as a textscan parameter/value pair, and it will ignore from the '>' to the end of the line.
  1 件のコメント
Par
Par 2011 年 12 月 20 日
Thanks Walter! To think of it, this solution was right under my nose, I just needed to read the help carefully. Nevertheless, I missed it. I needed someone like you to point this out to me! Thanks again.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by