How to skip randomly occurring header lines using textscan
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Export 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!