octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug] strread() elaborated format strings


From: Philip Nienhuis
Subject: Re: [Bug] strread() elaborated format strings
Date: Sun, 13 May 2012 05:56:40 -0700 (PDT)

Júlio Hoffimann wrote
> 
> Dear all,
> 
> strread('1 2 3 4 5 6',"%*n%n%*[^\n]")
> 
> The ugly format string above should produce 2 as output, i'm trying to
> reproduce the AWK capability of returning the 2-th column of a text file
> with textread() (which uses strread() under the hood).
> 
> Explaining the format:
> 
> %*n ignore the first number
> 
> %n get the second one
> 
> %*[^\n] ignore the longest non-empty string containing characters
> different
> of EOL.
> 
> In Octave 3.7.0+ from hg, the command produces an error:
> 
> strread('1 2 3 4 5 6',"%*n%n%*[^\n]")
> error: strread: A(I): index out of bounds; value 1 out of bound 0
> error: called from:
> error:   /opt/octave/share/octave/3.7.0+/m/io/strread.m at line 294,
> column
> 7
> 
> Someone could confirm the bug?
> 

Yep, but not so much "confirmed" in the sense that your example doesn't work
- format specifiers like [^\n] are simply not supported (yet?).
The actual bug is that strread.m chokes on it.

BTW missing format conversion specifiers are listed in bug #33875 (for
textscan that is, but as you know strread.m is also the work horse for
textscan.m).

Could you file a bug report, please? Then I'll look into it.

Thanks, Philip

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Bug-strread-elaborated-format-strings-tp4623342p4629737.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]