Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: textread/textscan not reading formatted text with whitespace
Replies: 19   Last Post: Oct 22, 2013 5:13 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,262
Registered: 6/7/07
Re: textread/textscan not reading formatted text with whitespace
Posted: Oct 2, 2013 12:57 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 10/2/2013 11:25 AM, Norbert Marwan wrote:
...

> Obviously, the whitespace is not counted in the formatted file.
> It seems to me that this is a bug. I have tried several things, e.g., to
> define another delimiter in the textread command, but this did not work.


...

One would think it should be a bug indeed but unfortunately it isn't. :(

It's defined C input-scanning behavior; you're just not supposed to do
that according to C.

The only choice is to do one of the following --

a) If possible create the file as delimited rather than fixed width

b) Read the file in as a single char array and do a global substitution
to insert a delimiter then parse the result from memory

c) Any variation of b) such as a line at a time

d) Use regular expressions

e) Write a Fortran mex file to parse the file and return it to Matlab
using Fortran fixed-width fields (or, as long as there are not empty
fields, list-directed i/o works as well).

I would urge you to add to the clamor by requesting TMW fix this
oversight/shortcoming by submitting formal feature request to support at
the mathworks.com site. (This has been one of my pet peeves for 20+ yr
as regulars at cs-sm will attest :) )

--




Date Subject Author
10/2/13
Read textread/textscan not reading formatted text with whitespace
Norbert Marwan
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
Norbert Marwan
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
Derek Goring
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/3/13
Read Re: textread/textscan not reading formatted text with whitespace
Norbert Marwan
10/3/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
Norbert Marwan
10/2/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/3/13
Read Re: textread/textscan not reading formatted text with whitespace
Norbert Marwan
10/3/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/22/13
Read Re: textread/textscan not reading formatted text with whitespace
Norbert Marwan
10/22/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/22/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/22/13
Read Re: textread/textscan not reading formatted text with whitespace
Norbert Marwan
10/22/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb
10/22/13
Read Re: textread/textscan not reading formatted text with whitespace
dpb

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.