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

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

[Octave-bug-tracker] [bug #53685] textscan() with Delimiter specified al


From: Frank Demarest
Subject: [Octave-bug-tracker] [bug #53685] textscan() with Delimiter specified always treats multiple delimiters as one
Date: Thu, 19 Apr 2018 07:28:58 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Follow-up Comment #2, bug #53685 (project octave):

Thanks for your reply. I tried your examples on both Octave 4.2.2 and Matlab
2017b. In some cases, Matlab is different in how it displays "ans" cell array
returns, so I used celldisp() for both.

Your first example: 
* textscan ("A,B C,D", "%s", "delimiter", ',')
is same on both Octave and Matlab

Your second example:
* textscan ("A,,,B C,D", "%s", "delimiter", ',')
is same on both Octave and Matlab.

Your number and string example is like the problem I'm trying to solve. Both
Malab and Octave give the same results as your example.

Now I see my problem is that I was using commas as separators in the format
strings, as I would for sscanf(). In some cases, Matlab and Octave give
different results, for example:
* celldisp(textscan ("A,,,B C,D", "%s,%s,%s,%s,%s", "delimiter", ','))
but now this seems like incorrect usage.

Both Matlab and Octave documentation examples show spaces for separators in
the format string of textscan(). The octave documentation is a little more
complete in the description.

I changed the commas in my format string to spaces, now it works as expected.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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