octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #47778] textscan ReturnOnError setting misinte


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #47778] textscan ReturnOnError setting misinterpreted in test
Date: Sun, 24 Apr 2016 21:13:10 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40

URL:
  <http://savannah.gnu.org/bugs/?47778>

                 Summary: textscan ReturnOnError setting misinterpreted in
test
                 Project: GNU Octave
            Submitted by: philipnienhuis
            Submitted on: Sun 24 Apr 2016 11:13:09 PM CEST
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Philip Nienhuis
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

Investigating textscan FAILs on Windows with a just cross-compiled dev Octave,
I found this behavior:

:
>>  fprintf (fid, "1 2 3\n4 s 6");
>>  fseek (fid, 0, "bof");
>> c = textscan (fid, "%f %f %f")
c =
{
  [1,1] =
     1
     4
  [1,2] =  2
  [1,3] =  3
}
>> fseek (fid, 0, "bof");
>> d = textscan (fid, "%f %f %f", "ReturnOnError", 1)
d =
{
  [1,1] =
     1
     4
  [1,2] =  2
  [1,3] =  3
}

:
assert (c, {[1;4], [2;NaN], [3;6]})
:
ASSERT errors for:  assert (cond {i},expected {i},tol)
  Location  |  Observed  |  Expected  |  Reason
     .          O(1x1)       E(2x1)      Dimensions don't match


Now, the first call is functionally the same as the second, as ReturnOnError's
default setting = "true" (at least it is in Matlab), and should return the
same data as the second.

I think the first textscan call should rather be:
c = textscan (fid, "%f %f %f", "ReturnOnError", 0);
and the assert should rather check for an error message like "error: textscan:
Read error in field"





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47778>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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