reading data after a string
Show older comments
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 Comments
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
on 27 Oct 2013
Cedric
on 27 Oct 2013
And how does the table end? Is it the end of file or is there some other content afterwards?
Accepted Answer
More Answers (1)
Walter Roberson
on 27 Oct 2013
0 votes
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.
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!