How to start reading from a specific line in a text file?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a text file that has both text and numeric data. How do I read from a particular line to a particular line, say from line 40 to 50 and assign the numeric data to variable names?
0 comentarios
Respuestas (1)
Cris LaPierre
el 18 de Mzo. de 2020
What type of text file?
Genearlly, you would use fseek to get to the starting point you want, and fgetl to read in your data line by line. However, fseek requires you to specify the number of bytes to move.
You could use textscan, which allows you to specify the number of headerlines. If the format of your numeric data is the same on each line, you could also specify how many times to apply the specified format spec (number of lines to read in).
0 comentarios
Ver también
Categorías
Más información sobre Text Files 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!