bugGNU Octave - Bugs: bug #32066, textscan error


bug #32066: textscan error

Submitted by:  Guillaume <gyom>
Submitted on:  Thu Jan 6 14:18:37 2011  
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Wed Jan 19 12:10:31 2011, comment #11:

Thank you, it makes sense now. PCRE is indeed not installed on my system.
It works fine now - note that MATLAB was also returning a wrong answer with the previous regexp.

Guillaume <gyom>
Wed Jan 19 09:13:41 2011, comment #10:

I checked in the following changeset:


This seems to fix the problem for me, so I'm closing this report.

John W. Eaton <jwe>
Project Administrator
Tue Jan 18 20:27:19 2011, comment #9:

The tests will succeed if the PCRE library is used for regexps. It fails on my system if the PCRE library is not used.

That difference is not intentional, so we should either fix the uses of regexp in sttread.m to not require PCRE, or we should probably just require PCRE to build Octave. Then at least we would be able to count on a particular set of regexp capabilities being available.

John W. Eaton <jwe>
Project Administrator
Tue Jan 18 19:54:51 2011, comment #8:

This works for mee with todays TIP

octave:4> t = textscan('aaa.bbb','%s','delimiter','.');
octave:5> t
t =
[1,1] =
[1,1] = aaa
[2,1] = bbb

Doug Stewart <dastew>
Tue Jan 18 19:30:22 2011, comment #7:

I just checked again that the functions I'm calling from latest Octave dev are the same than here:


same for you? All the tests fails with these files...

Guillaume <gyom>
Tue Jan 18 19:19:56 2011, comment #6:

Ok. for Octave built with sources current 48 yrs ago ...

With Matalb

Ben Abbott <bpabbott>
Project Member
Tue Jan 18 18:51:59 2011, comment #5:

Thanks for looking into this but I'm really puzzled...
Using the developers sources, nothing works for textscan:
For the example I sent, I get:
are we talking about the same files ?!?

Concerning the output, it's as it should be (a cell array containing a cell array) and matches with MATLAB.

Guillaume <gyom>
Tue Jan 18 18:16:43 2011, comment #4:

opps ... I attached the same changeset. Try the 3rd attempt.

(file #22441)

Ben Abbott <bpabbott>
Project Member
Tue Jan 18 18:13:29 2011, comment #3:

If the prior simple change is the correct thing to do, then this second one is a better implementation and includes a new test.

(file #22440)

Ben Abbott <bpabbott>
Project Member
Tue Jan 18 18:07:59 2011, comment #2:

Unfortunately, using your suggestion the tests for strread and textscan produce failures for me.

Using the developers sources, all tests for strread and textscan pass.

For the original problem

This is parsing the data correctly, but is not returning it in the proper format.

I haven't studied this bug, but the fix might be quite simple. For example, see the attached changeset.

(file #22439)

Ben Abbott <bpabbott>
Project Member
Tue Jan 18 17:30:05 2011, comment #1:

Actually, I think it's an error in strread.m, following that change:
I replaced l.191 in latest version with
[~, ~, ~, fmt_words] = regexp (format, '\%\w+');
and the example below now works, as well as all the tests but two (compared to none before).

Guillaume <gyom>
Thu Jan 6 14:18:37 2011, original submission:

When running
in Octave dev, one gets:
error: strread: format does not match data
while one gets the expected answer in MATLAB: {'aaa';'bbb'}

This relates to these:

Guillaume <gyom>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #22440:  changeset.patch added by bpabbott (1kB - 2nd iteration)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by dastew (Posted a comment)
  • -unavailable- added by bpabbott (Updated the item)
  • -unavailable- added by gyom
  • -unavailable- added by gyom (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Jan 19 09:13:41 2011jweStatusNone=>Fixed
    Tue Jan 18 18:16:43 2011bpabbottAttached File-=>Added changeset.patch, #22441
    Tue Jan 18 18:13:29 2011bpabbottAttached File-=>Added changeset.patch, #22440
    Tue Jan 18 18:07:59 2011bpabbottAttached File-=>Added changeset.patch, #22439
    Tue Jan 18 17:30:05 2011gyomCarbon-Copy-=>Added -unavailable-

    Back to the top

    Powered by Savane 3.1-cleanup