Keep space at beginning of a row (textscan)

I have a file I am reading in with textscan, which works perfectly, except when there is a space at the beginning of the line that I'm reading in. I have it delimiting at the end of a line ('\n'), which is fine, it just drops any whitespace at the beginning of the line, which is not okay. Is there any way to tell it to read the file lines in exactly?
Ex: I want it to read in " 100" as " 100", not "100".
Thanks! Sarah

 Accepted Answer

Perhaps disabling all white-space removing helps:
textscan(fid, '%s', 'delimiter', '\n', 'whitespace', '')

More Answers (0)

Categories

Products

Asked:

on 10 Jun 2013

Community Treasure Hunt

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

Start Hunting!