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

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

[Octave-bug-tracker] [bug #38003] textscan() "endofline" compatibility


From: Ben Abbott
Subject: [Octave-bug-tracker] [bug #38003] textscan() "endofline" compatibility
Date: Tue, 01 Jan 2013 17:44:59 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17

Update of bug #38003 (project octave):

                  Status:                    None => Invalid                
         Originator Name:                         => Ben Abbott             

    _______________________________________________________

Follow-up Comment #2:

The possible EOL characters are nicely itemized on Wikipedia.

http://en.wikipedia.org/wiki/Newline#Representations

The "\n\r" is certainly not a common one.  The crux of my report was my
understanding that Matlab's implementation respects *all* line endings
simultaneously  ... which isn't clear from the documentation, as it may be
interpreted to mean that a *single* line ending is used for each file and is
detected automatically.

Essentially, I was thinking that Matlab's implementation was based on regexp
(), and that they had implemented an effective and efficient way of splitting
a text file into lines,


lines = regexp (text, '\r\n|\n\r|\r|\n', 'split');


However, a quick test shows that my understanding was wrong.


eol = '\r\n|\n\r|\r|\n';
a = textscan (sprintf ('A\r\nB\n\rC\rD\nE'), '%s', 'endofline', eol)
Error using textscan
End of line character must be no more than a single character or \r\n


Further the "\r\n" variant also throws an error.


 a = textscan (sprintf ('A\r\nB\n\rC\rD\nE'), '%s', 'endofline', '\n\r')
Error using textscan
End of line character must be no more than a single character or \r\n


On a related not, while poking about on the internet, I came across a
reference to an undocumented functions as the backend to Matlab's strread()
and textread().  When passing the 'endofline' as '\r\n|\n\r|\r|\n' to
strread() or textread(), I get the same error as for textscan().  So it maybe
that dataread() is also the backend for textscan()?


help dataread
 dataread Read formatted data from string or file.
    dataread is the backend support function for TEXTREAD and STRREAD.
 
    See also strread, textread.


In any event, I'm marking this as "invalid".



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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