reading data after a string
Mostrar comentarios más antiguos
Hi,
I would like to read the data below the words 'Link Results'. What i would really like to know is how to get the line number in the text file that I'm trying to read that has 'Link Results'. After I get that I know how to read the data. so my question would be how to find that number.
Thanks!
3 comentarios
Copy/paste the whole line if the data is on the same line, or a chunk of the data if it is on multiple line, including the first line (with Link Results) and the delimiter for the end of the block. Also, is there just one block of data or are there multiple blocks?
Sergio
el 27 de Oct. de 2013
Cedric
el 27 de Oct. de 2013
And how does the table end? Is it the end of file or is there some other content afterwards?
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 27 de Oct. de 2013
0 votos
There are no functions built into MATLAB, or to any of the operating systems that current MATLAB run on, that can tell you which line number of a file that you are positioned to. None of the operating systems supported have any inherent concept of "line number".
Therefore if you want to know which line number something is on, you need to start at the beginning of the file, read line by line, counting each as you go, until you find the pattern you are looking for.
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!