bugGNU Octave - Bugs: bug #31380, textread() lacks format specifier...

 
 

bug #31380: textread() lacks format specifier repeat

Submitted by:  Ben Abbott <bpabbott>
Submitted on:  Wed 20 Oct 2010 04:10:10 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Other
Status: FixedAssigned to: None
Originator Name: Ben AbbottOpen/Closed: Closed
Release: devOperating System: Mac OS

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 27 Jul 2011 05:32:31 AM UTC, comment #9:

A bunch more compatibility changes were made in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/f5a3f77d51aa). The function textread() now supports format specifier repeat. Closing report.

Rik <rik5>
Project Administrator
Sun 24 Jul 2011 11:08:27 PM UTC, comment #8:

I pushed the changeset.

http://hg.savannah.gnu.org/hgweb/octave/rev/875c735c0929

Pls, let me know if it looks ok.

Ben Abbott <bpabbott>
Project Member
Sun 24 Jul 2011 11:07:06 PM UTC, comment #7:

With today's latest code fixes on my box (but perhaps it worked before them as well):

octave.exe:94> isequal (strread ('1 2 3 4', '%d', 2), [1; 2])
ans = 1
octave.exe:95>

Hopefully tomorrow I can prepare patches and have a look at the example data2.csv file.

Philip Nienhuis <philipnienhuis>
Project Member
Sun 24 Jul 2011 10:51:21 PM UTC, comment #6:

To be honest, I didn't check on how texread/scan function.

However, for strreadO on Matlab ...

Ben Abbott <bpabbott>
Project Member
Sun 24 Jul 2011 09:20:27 PM UTC, comment #5:

I think this is actually working. The documentation for textscan (http://www.mathworks.com/help/techdoc/ref/textscan.html) says that it does not use varargout the way your test is written. If I rewrite your test to use textread, which does behave the way you expect, than it works.

In any case, I just checked in more changes to these functions so you should do an update from Mercurial to changeset 12877:ddea3962b024 before further testing.

Rik <rik5>
Project Administrator
Sat 23 Jul 2011 07:07:12 PM UTC, comment #4:

Opps ... clicked submit too soon.

(file #23687)

Ben Abbott <bpabbott>
Project Member
Sat 23 Jul 2011 07:05:54 PM UTC, comment #3:

Rik,

I've attached a changeset which fixes the problem with strread.m.

I haven't pushed a changeset since we stopped manually including the ChangeLog entries. Please verify that my changeset is acceptable.

Ben Abbott <bpabbott>
Project Member
Sat 23 Jul 2011 11:29:11 AM UTC, comment #2:

I don't know if it is a regression, but the multiple output format no longer works.

[A, B, C, ...] = textread (filename, format)

Using the attached "data2.csv", the following doesn't work.

(file #23685)

Ben Abbott <bpabbott>
Project Member
Fri 22 Jul 2011 08:58:46 PM UTC, comment #1:

Can you re-verify your issue with a changeset greater than or equal to 12868:b00181c65533? Although the documentation has not been updated, strread now supports format specifier repeats and so the calling convention textread (filename, format, N) should work.

Rik <rik5>
Project Administrator
Wed 20 Oct 2010 04:10:10 AM UTC, original submission:

Matlab's version allows the format specification to be reused a specified number of times, N.

[A, B, C, ...] = textread (filename, format)
[A, B, C, ...] = textread (filename, format, N)
[...] = textread (..., param, value, ...)

If this functionality is added then it should be straight forward to modify textread() to implement the missing function textscan(). Perhaps it would be proper to rewrite textread() to call textscan().

textscan behaves as ...

C = textscan (fid, 'format')
C = textscan (fid, 'format', N)
C = textscan (fid, 'format', 'param', value)
C = textscan (fid, 'format', N, 'param', value)
C = textscan (str, ...)
[C, position] = textscan (...)

... where C is a cell array ... a concatenation of the outputs for textread().

Ben Abbott <bpabbott>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #23687:  changeset.patch added by bpabbott (2kB - application/octet-stream - changeset #1)
file #23685:  data2.csv added by bpabbott (86B - text/csv)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by philipnienhuis (Posted a comment)
  • -unavailable- added by rik5 (Another strread related issue report)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by bpabbott (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 27 Jul 2011 05:32:31 AM UTCrik5StatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Sun 24 Jul 2011 09:16:47 PM UTCrik5Carbon-Copy-=>Added philipnienhuis
    Sat 23 Jul 2011 07:07:12 PM UTCbpabbottAttached File-=>Added changeset.patch, #23687
    Sat 23 Jul 2011 11:29:11 AM UTCbpabbottAttached File-=>Added data2.csv, #23685
    Fri 22 Jul 2011 08:58:46 PM UTCrik5StatusNone=>Need Info
      Summarytextread() is not compatible with Matlab=>textread() lacks format specifier repeat

    Back to the top


    Powered by Savane 3.1-cleanup