How to skip text lines in a .dat file

8 次查看(过去 30 天)
Dear all,
I want to import a large .dat file in matlab; when I use the command "importdata" it only imports the first part of the data, it stops when the .dat file reaches a text line. So I'm wondering if there is a way to import all the data by skipping or eliminating the text lines from the .dat file.
The text lines example I'd like to eliminate/skip is shown in the immage "Zone T= "3", [...], strandid=1". There's one about every 21209 lines.
Cattura.JPG

回答(1 个)

Rik
Rik 2020-1-30
When the automatic tools fail, it is generally the easiest to fall back to doing it yourself:
  1. Read the file as text (e.g. with the readfile function)
  2. Remove lines you don't need
  3. Parse remaining lines to an array (e.g. with textscan or cellfun)

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by