reading data after a string
이전 댓글 표시
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
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
2013년 10월 27일
Cedric
2013년 10월 27일
And how does the table end? Is it the end of file or is there some other content afterwards?
채택된 답변
추가 답변 (1개)
Walter Roberson
2013년 10월 27일
0 개 추천
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.
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!