bugGNU Octave - Bugs: bug #33875, textscan: missing format...


bug #33875: textscan: missing format conversion specifiers

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Thu 28 Jul 2011 06:17:08 AM UTC  
Category: InterpreterSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Philip NienhuisOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)

You are not logged in

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


Sat 19 Mar 2016 10:29:50 PM UTC, comment #4:

As of https://savannah.gnu.org/patch/index.php?8783 we now have a binary textscan featuring all those missing format specifiers, and more.


Philip Nienhuis <philipnienhuis>
Project Member
Mon 09 Jul 2012 08:26:11 PM UTC, comment #3:


Philip Nienhuis <philipnienhuis>
Project Member
Mon 25 Jun 2012 08:44:50 PM UTC, comment #2:

Error msg for this and other ML-compatible but unsupported specifiers in this changeset:
(which refers to strread.m, as that does the hard work for textscan) - see also bug #36464.

I've got %[]-like and %q format specifiers working but I'll probably post the relevant cset-to-be-made to the patch tracker. I agree with Rik's advice that strread.m's current setup is too fragile for a reliable implementation.

Bit width (%d8, %u64, ...) specifiers also work here but a separate patch for those is in the making; it may also end up on the patch tracker only.

Status -> postponed, Release -> dev

Philip Nienhuis <philipnienhuis>
Project Member
Mon 28 May 2012 09:01:14 PM UTC, comment #1:

Patch attached for
- %[..], %[..], %[^..] and %[^..] specifiers;
- %u8 %u16 %u32 %u64 %d8 %d16 %d32 %d64 %f32 %f64 specifiers.

I'll have a look at %q %*q support later in June.

See also bug #36464
Not-yet-pushed fixes for bugs #36356, #36392, #36398 are included.

(file #25948)

Philip Nienhuis <philipnienhuis>
Project Member
Thu 28 Jul 2011 06:17:08 AM UTC, original submission:

(known issue, entered in bug tracker so we don't forget after bugs #31380, #33680, #33536, #32720, #31778 and maybe a few others have been fixed lately)

%d8 %d16 %d32 %d64
%f32 %f64
%u8 %u16 %u32 %u64 (unsigned integers)

ML reads integers by default as 32bit, floats as 64bit. Provisionally Octave reads all these values as doubles.
Type casting -if needed- can be done on textscan's output.
Precision digits trailing the format specifier (e.g., "32", "64") have to be removed from the input format string as Octave will treat them as literals.

These are read by Octave as if %f was specified (doubles)

%q (read string between double quotes)
%c (read single character including delimiters)
%[...] (patter matching)
%[^...] ''
There is no workaround for these.
To some extent %c can be replaced by %1s
In simple cases %q might be replaced by clever use of " literals.

Some background:
Octave processes text files by (in principle) reading them completely and then processing the read text string by parsing it into data columns according to the layout of the format string. Reading then proceeds by transforming the columns into the desired format (class).
Any format conversion specifier for which it isn't known in advance where the actual data field limits (~delimiters) appear on a line (which may be different for each line in the file) will break Octave's column parsing scheme.
This applies to %q, %c and especially %[..], %[^..]

Philip Nienhuis <philipnienhuis>
Project Member


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

Attach File(s):

Attached Files
file #25948:  textscan_strread_33875.patch added by philipnienhuis (35KiB - application/x-download)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by philipnienhuis (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
    Sat 19 Mar 2016 10:29:50 PM UTCphilipnienhuisStatusPostponed=>Fixed
    Mon 09 Jul 2012 08:26:11 PM UTCphilipnienhuisSeverity3 - Normal=>2 - Minor
    Mon 25 Jun 2012 08:44:50 PM UTCphilipnienhuisStatusPatch Submitted=>Postponed
    Mon 28 May 2012 09:01:14 PM UTCphilipnienhuisAttached File-=>Added textscan_strread_33875.patch, #25948
      StatusNone=>Patch Submitted

    Back to the top

    Powered by Savane 3.1-cleanup1