Leaving out the header when reading in a text file
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Hi
I am trying to read in my text file using this:
   fname=[PATHIN, textfile];
        fid=fopen(fname);
            for i=1:72
            [M1(i,:)]=fscanf(fid,'%i', [1 6]);
            end
Except, it gives me an error because in the first line of the text file is the header which lists what each column is. Is there a line I can include in this script to tell MATLAB to skip the first line of each of the text files? Or to ignore strings and only read in numbers?
Thanks a lot for the help in advance :)
Jan
0 Kommentare
Akzeptierte Antwort
  Walter Roberson
      
      
 am 18 Jun. 2012
        After the fopen(), add
   fgetl(fid);
to read and discard the first line.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Text Data Preparation finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!