Why does %c not read whitespaces with the TEXTREAD function?
Show older comments
Why does %c not read whitespaces with the TEXTREAD function?
I am trying to read a file using TEXTREAD. Here is an example input file:
one two three four
one two three four
I should be able to read this file using
[a, b] = textread('file', '%3c%3c%*[^\n]');
and expect the output to be:
a=[ 'one'; 'one' ] and
b=[ ' tw'; ' tw'; ]
But I get
a=[ 'one'; 'one' ] and
b=[ 'two'; 'two' ]
It appears that the whitespace between the 'one' and 'two' is skipped.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown 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!