Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Extract numbers from table containing text and numbers
Date: Tue, 05 Feb 2013 08:17:48 -0600
Organization: Aioe.org NNTP Server
Lines: 39
Message-ID: <ker49o$r10$1@speranza.aioe.org>
References: <kef9u8$seu$1@newscl01ah.mathworks.com> <kelcdc$i6l$1@newscl01ah.mathworks.com> <kelu2o$7qj$1@speranza.aioe.org> <kelvcr$l9k$1@newscl01ah.mathworks.com> <kem3f8$psl$1@speranza.aioe.org> <kep344$lu6$1@newscl01ah.mathworks.com> <kepasd$k95$1@speranza.aioe.org> <keplqs$he2$1@speranza.aioe.org> <keqacc$c7l$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: z09W+5EmwwrnqEjpmOLFzA.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com comp.soft-sys.matlab:788264

On 2/5/2013 12:55 AM, Bruno Luong wrote:
> dpb <none@non.net> wrote in message <keplqs$he2$1@speranza.aioe.org>...
>
>>
>> The killer w/ C's i/o functions is their complete inability to
>> "understand" fix-width fields--it's simply absurd that one can't read
>> the equivalent of a Fortran FORMAT(5I1) w/ a record of '101 1' and
>> reliably get 1,0,1,0,1 returned in appropriate variables. In Matlab
>> (and C) that's nearly impossible w/o special handling.
>>
>
> What's problem? The fixed format reading is just take the right column
> of the char matrix. OK you have to count the column, but that's really a
> big deal?

The problem is there's no way to write a format string that will parse 
the above example input string correctly w/o actually doing the 
character manipulation directly.

Yes, that's a big deal for large files in terms of overhead plus the 
necessity of having to write special code to handle it when it should be 
a trivial formatting operation.

It's a remnant of the design of C that didn't really consider i/o to be 
terribly important it appears...

> Writing with fixed-format with MATLAB is another matter (there is simply
> no easy way of doing it).

I keep hearing this, but on output the fixed-width fields do work at 
least reasonably well--there have been several threads on the subject I 
can recall over the last several months or so but I can't remember a one 
that wasn't solvable pretty easily w/ just the proper formatting strings.

Output works reasonably well; fixed-width non-delimited input is just 
broken (by C Library definition which underlies the Matlab formatted i/o 
implementation).

--