Read a .txt file character by character

Hey, I would like to read in a file which looks like the above picture. Now this file contains raw data as well as the GNGGA NMEA sentence. I am only interested in this sentence. Unfortunately it also could be that this sentence is spread over two rows. But it alwayse starts with a $ and ends with a *. My problem is I have to read it in not line by line (I managed that already) but character by character if the content is spread over more than one line.
Any ideas (short examples) how I can do that?

Answers (1)

fopen the file. fread(fid, 1, 'uint8=>char') to get one character
However if the file would fit comfortably in memory it would be far more efficient to fileread() the entire file and then search the array, possibly with regexp()

1 Comment

Thanks for that suggestion. I will try it.... :)

Sign in to comment.

Asked:

on 31 Jul 2016

Commented:

on 4 Aug 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!