Please help write a script to display the first line of this text file using fgetl
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Steve
 el 27 de Mzo. de 2014
  
    
    
    
    
    Comentada: Steve
 el 27 de Mzo. de 2014
            I am very new to matlab so please explain it assuming I don't know very much about it. Thanks in advance. Here is the first few lines of the text file, I would like "Header Lines = 15" to be displayed. It would also be great if you could show me how to pull up other specific lines in the file!
Header Lines = 15
Tilt Illusion Experiment
Subject Number      = 1
Target Contrast     = 0.50
Flanker Contrast    = 0.50
0 comentarios
Respuesta aceptada
Más respuestas (1)
  Jacob Halbrooks
    
 el 27 de Mzo. de 2014
        
      Editada: Jacob Halbrooks
    
 el 27 de Mzo. de 2014
  
      You just need to use FOPEN to create a file handle, and then each call to FGETL on that handle will read a line of text. Here's code that will keep calling FGETL until the end of the file is reached:
fid = fopen('myfile.txt','r');
while ~feof(fid)
    line = fgetl(fid);
    disp(line);
end
fclose(fid);
Be sure to call FCLOSE when you are done with the file.
Ver también
Categorías
				Más información sobre Entering Commands en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


