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

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

[Octave-bug-tracker] [bug #38317] textread & textscan give different res


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #38317] textread & textscan give different results in MATLAB and Octave
Date: Tue, 12 Feb 2013 23:20:42 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Update of bug #38317 (project octave):

                 Summary: Textread gives different results in MATLAB and
Octave => textread & textscan give different results in MATLAB and Octave

    _______________________________________________________

Follow-up Comment #2:

Upon closer inspection in your report I now see that you actually got text
output rather than numerical output. Which IMO would be a ML bug as ML's
default format is %f (numeric) rather than %s (string).

However, with ML r2013a prerelease I get:

>>  textread('deaths.txt', '', 'headerlines', 3) 

ans =

         0    5.6900    4.3700
    1.0000    0.5800    0.5900
    2.0000    0.4300    0.4200
    3.0000    0.3100    0.2900
:

(i.e., a 100x3 double array).

What ML version do you have?

Anyway AFAICS this isn't documented ML behavior. Yet I think it would be easy
(and IMO useful) to patch strread.m to get similar behavior.

FWIW, textscan.m behaves differently than Octave as well. I'll look into that
too:

>> fid = fopen ('deaths.txt');
>> textscan (fid, '', 'headerlines', 3)
ans = 
    [100x1 double]    [100x1 double]    [100x1 double]

while Octave does:

octave:2> fid = fopen ('deaths.txt');
octave:3> C = textscan (fid, '', 'headerlines', 3)
C =
{
  [1,1] =

       0.00000
       5.69000
       4.37000
       1.00000
       0.58000
       0.59000
       2.00000
       0.43000
       0.42000
       3.00000
       0.31000
       0.29000
:
<snip>
octave:4> size (C{1})
ans =
   300     1



Title adapted to include textscan.

Please have some patience.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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