bugGNU Octave - Bugs: bug #32066, textscan error

 
 

bug #32066: textscan error

Submitted by:  Guillaume <gyom>
Submitted on:  Thu 06 Jan 2011 02:18:37 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

( Jump to the original submission)

Wed 19 Jan 2011 12:10:31 PM UTC, 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 19 Jan 2011 09:13:41 AM UTC, comment #10:

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/90f8d12f1964

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

John W. Eaton <jwe>
Project Administrator
Tue 18 Jan 2011 08:27:19 PM UTC, 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 18 Jan 2011 07:54:51 PM UTC, 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
}
}
octave:6>

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

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

http://hg.savannah.gnu.org/hgweb/octave/file/1811f4f8b3b5/scripts/io/strread.m
http://hg.savannah.gnu.org/hgweb/octave/file/1811f4f8b3b5/scripts/io/textscan.m

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

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

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

With Matalb

Ben Abbott <bpabbott>
Project Member
Tue 18 Jan 2011 06:51:59 PM UTC, 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 18 Jan 2011 06:16:43 PM UTC, comment #4:

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

(file #22441)

Ben Abbott <bpabbott>
Project Member
Tue 18 Jan 2011 06:13:29 PM UTC, 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 18 Jan 2011 06:07:59 PM UTC, 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 18 Jan 2011 05:30:05 PM UTC, comment #1:

Actually, I think it's an error in strread.m, following that change:
http://hg.savannah.gnu.org/hgweb/octave/diff/64728cd28d7a/scripts/io/strread.m
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 06 Jan 2011 02:18:37 PM UTC, original submission:

When running
textscan('aaa.bbb','%s','delimiter','.')
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:
http://octave.1599824.n4.nabble.com/textscan-wanted-td3002808.html
https://savannah.gnu.org/bugs/index.php?31380

Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-01-19 jwe StatusNone => Fixed
        Open/ClosedOpen => Closed
    2011-01-18 bpabbott Attached File- => Added changeset.patch, #22441
    2011-01-18 bpabbott Attached File- => Added changeset.patch, #22440
    2011-01-18 bpabbott Attached File- => Added changeset.patch, #22439
    2011-01-18 gyom Carbon-Copy- => Added -email is unavailable-

    Back to the top


    Powered by Savane 3.4