I am trying to read a text file in MATLAB which has a format like the following. I am looking to read the whole line as a string.
2402:0.099061 2404:0.136546 2406:0.447161 2407:0.126333 2408:0.213803 2411:0.068189
I tried couple of things.
textscan(fid, '%s')
reads the line but splits the line into cells at spaces.
fscanf(fid, '%s')
reads the line as a string but removes all the spaces.
fgetl(fid)
will do what you're looking for. Newline is stripped off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With