bugGNU Octave - Bugs: bug #58079, textscan goes past EOL when fmt...


bug #58079: textscan goes past EOL when fmt contains multiple items but input does not

Submitter:  Rik <rik5>
Submitted:  Mon 30 Mar 2020 01:37:49 AM UTC
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 30 Mar 2020 01:37:49 AM UTC, original submission:  

Sample code

C = textscan(sprintf ('one\ntwo\nthree\nfour\n'), '%s %s')

In Matlab, C{1} contains "one", "two", "three", "four", and C{2} contains four "" entries.

In Octave, the newline gets eaten and the the second '%s' format takes the next string.

C =
  [1,1] =
    [1,1] = one
    [2,1] = three

  [1,2] =
    [1,1] = two
    [2,1] = four


Rik <rik5>
Group administrator


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by efferre79
  • -email is unavailable- added by rik5 (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-01-09 efferre79 Carbon-Copy- Added efferre79

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code