Keep space at beginning of a row (textscan)

48 views (last 30 days)
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

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

More Answers (0)

Categories

Find more on Large Files and Big Data in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!