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

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

[Octave-patch-tracker] [patch #8783] C++ implementation of textscan


From: Ben Abbott
Subject: [Octave-patch-tracker] [patch #8783] C++ implementation of textscan
Date: Fri, 18 Mar 2016 00:11:41 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4

Follow-up Comment #95, patch #8783 (project octave):

@All, I'm able to build from a fresh archive.

However, I see some unexpected behavior (Mac OS X). textscan does not give
consistent results when using character and file input.


c = textscan (sprintf ('1 2 3\n4 s 6\n'), '%f %f %f', 'ReturnOnError', 1)
c = 
{
  [1,1] =

     1
     4

  [1,2] =

       2
     NaN

  [1,3] =

       3
     NaN

}
 
>>  f = tempname ();
>>  fid = fopen (f, "w+");
>>  fprintf (fid, "1 2 3\n4 s 6\n");
>>  fseek (fid, 0, "bof");
>>  c = textscan (fid, "%f %f %f", "ReturnOnError", 1);
>>  fseek (fid, 0, "bof");
>>  fclose (fid);
>>  unlink (f);
>> c
c = 
{
  [1,1] =

     1
     4

  [1,2] =  2
  [1,3] =  3


Using Matlab, I get a consistent result.


c = textscan (fid, '%f %f %f', 'ReturnOnError', 1)

c = 

    [2x1 double]    [2]    [3]

>> c = textscan (sprintf ('1 2 3\n4 s 6\n'), '%f %f %f', 'ReturnOnError', 1)

c = 

    [2x1 double]    [2]    [3]


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8783>

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




reply via email to

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