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

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

[Octave-bug-tracker] [bug #53277] textscan(...) does not parse sequence


From: Rik
Subject: [Octave-bug-tracker] [bug #53277] textscan(...) does not parse sequence of integers separated by dots (.)
Date: Mon, 5 Mar 2018 00:55:38 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #53277 (project octave):

                Priority:              5 - Normal => 3 - Low                
                  Status:                 Invalid => Confirmed              
             Open/Closed:                  Closed => Open                   

    _______________________________________________________

Follow-up Comment #7:

@Philip: I think we can allow the bug report.  I agree with your opinion that
textscan is far too complicated, and it is unlikely that TMW will actually fix
this.  But because it is so rare, I don't think it hurts to be
Matlab-incompatible here and do the right thing.  In addition, we have a
guarantee that anyone using Matlab will never use this pattern because it
doesn't read the data correctly.  Hence, no one who uses Matlab will actually
experience any incompatibility.

I'm marking the bug as confirmed, but also lowering the priority as there are
many, many workarounds.  I personally don't have any time to work on this.

For the original reporter, there is no schedule for when this might get fixed
so I would just choose one of the workarounds and move on.

If your data is really structured this simply then dlmread() would be a good
choice.  If you absolutely must use a file descriptor then try scanf--it gets
it right.  Demonstrating with sscanf 


 sscanf ('5.2.1975', '%d.%d.%d')
ans =

      5
      2
   1975


You could change the FORMAT string that you give to textscan as Philip
suggested to include field widths ('%2d.%2d.%4d').

You could also switch the file to use a different delimiter using something
like this Perl command.


perl -i.bak -pe 's/\./#/g' file_name


followed by reading with the pattern '%d#%d#%d'.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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