How do I detect line number while reading a file?
9 views (last 30 days)
Show older comments
Clay Fulcher
on 14 Jun 2020
Commented: Clay Fulcher
on 15 Jun 2020
Is there a way to detect the line number while reading a text file? ftell will give a pointer in the file, but not the line number.
Thanks
0 Comments
Accepted Answer
per isakson
on 15 Jun 2020
There is no function that takes the output of ftell() and returns the line number.
One has to keep track of the line number with user code. However, that is hard to combine with the use of fseek().
More Answers (0)
See Also
Categories
Find more on Low-Level File I/O 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!