[Top][All Lists]

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

[Octave-bug-tracker] [bug #41579] HeaderLines parameter in textscan diff

From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #41579] HeaderLines parameter in textscan different between Octave and ML
Date: Thu, 13 Feb 2014 22:22:25 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22.1

Update of bug #41579 (project octave):

                  Status:                    None => Need Info              


Follow-up Comment #2:

I can confirm the difference in behavior between Octave 3.8.0 & Matlab
r2014a-prerelease on Windows.

I suspect un-/obscurely documented, or at least misunderstood, Matlab
behavior, i.e., in how far the EOL char is included in delimiters when reading
from file (see below for more on this). 
Yet I do agree that Matlab's behavior is at least unexpected (to the unwary

Some analysis:
After executing the first textscan command from test.m, 'ftell (fid)' on
Octave gets me 41 while on Matlab it is 40.
Counting the characters (incl. tabs) on the first line of test.txt gives 40;
so it seems Matlab doesn't "eat" the EOL char. IOW, on the next call to
textscan it seems to include that EOL in the 'headerlines' count rather than
the next EOL (on L.2).
Now, the ML docs say that "... headerlines are skipped, incl. the remainder of
the current line ...". But it is a bit ambiguous to me whether this would also
apply to the remaining sole EOL on line 1.

In Matlab, specifying '\t\n' as delimiter value for all textscan calls gets
ftell(fid) to report 41 after the first textscan call in test.m, and after the
second call with "'headerlines', 1" Matlab correctly reports the output as a
{2x5 double}.
Octave's behavior isn't affected by this; so there's a workaround for you to
have Octave and Matlab behave identically.

At first sight I'd say this is a Matlab bug. When a "headerlines" parameter is
specified it looks obvious to me that EOLs should be eaten by it, including
EOL in "the remainder of the current line" as their docs state. But I'm not
sure; so please report it to the Mathworks and report back their answer here.
Or for faster answers, ask in usenet NG comp.soft-sys.matlab (hint: don't
mention Octave ;-) ); the resident Mathworks-employed guru there is often
quick to reply.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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