How can I skip lines when loading a text file?

89 ビュー (過去 30 日間)
Baba
Baba 2012 年 2 月 1 日
コメント済み: Walter Roberson 2016 年 11 月 7 日
Is there a way to use load to load a text file but skip a few lines which contain headers and other info and just load numerical data in columns that come after the headers?

回答 (1 件)

Sven
Sven 2012 年 2 月 1 日
Hi Baba, try importdata:
importdata(FILENAME, DELIM, NHEADERLINES) loads data from ASCII file FILENAME, reading numeric data starting from line NHEADERLINES+1.
  5 件のコメント
Walter Roberson
Walter Roberson 2016 年 11 月 7 日
Shania Hurst, I suggest you consider using readtable() with HeaderLines . (readtable() might even be able to figure out for itself how many header lines are there.)

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

Community Treasure Hunt

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

Start Hunting!

Translated by