Why does TEXTSCAN ignore my whitespace parameter in MATLAB 7.0.1 (R14SP1)?

1 view (last 30 days)
When I try to read in a file of the following format:
"5","10","20"
"10","256","13"
using the following TEXTSCAN command:
A = textscan(fid,'%f%s%f','whitespace','\b\t" ','delimiter',',')
the contents of A{2} are:
10"
256"
It appears that my whitespace format specification is being ignored.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Jul 2009
This enhancement has been incorporated in Release 2006b (R2006b). For previous product releases, read below for any possible workarounds:
There is an issue in MATLAB 7.0.1 (R14SP1) in the way that TEXTSCAN handles the %s format with a custom whitespace option. To work around this issue, you can clean the resulting data using the STRREP command. For example, you might use:
A{2} = strrep(A{2},'"','');

More Answers (0)

Products


Release

R14SP1

Community Treasure Hunt

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

Start Hunting!