bugGNU Octave - Bugs: bug #47192, sprintf on transposed strings...


bug #47192: sprintf on transposed strings different in Octave and Matlab (Octave only prints first char)

Submitter:  Richard <crobar>
Submitted:  Thu 18 Feb 2016 03:46:59 PM UTC
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Richard Crozier Open/Closed:  * Closed
Release:  * 4.0.1-rc1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 18 Feb 2016 08:14:26 PM UTC, comment #4: 

It seems to work for me so I pushed the changeset on stable and merged to default:


John W. Eaton <jwe>
Group administrator
Thu 18 Feb 2016 07:29:22 PM UTC, comment #3: 

Here's a patch to try.  I'm running tests now.  With some luck it doesn't break something else...

(file #36389)

John W. Eaton <jwe>
Group administrator
Thu 18 Feb 2016 06:06:52 PM UTC, comment #2: 

Retitling as a regression, since earlier versions did this (what I assume for now is) correctly

sprintf ("%s", repmat ("blah", 4, 1))
ans = bbbbllllaaaahhhh

sprintf ("%s", repmat ("blah", 4, 1))
ans = bbbbllllaaaahhhh

sprintf ("%s", repmat ("blah", 4, 1))
ans = blah

Mike Miller <mtmiller>
Group Member
Thu 18 Feb 2016 06:03:19 PM UTC, comment #1: 

What does Matlab return when given a character matrix, e.g.

sprintf('%s', repmat('blah',4,1))

Mike Miller <mtmiller>
Group Member
Thu 18 Feb 2016 03:46:59 PM UTC, original submission:  

In Matlab I get the following:

>> sprintf('%s', 'blah')

ans =


>> sprintf('%s', ('blah')')

ans =


In Octave I get:

octave:11> sprintf('%s', 'blah')
ans = blah
octave:12> sprintf('%s', ('blah')')
ans = b

So, as you can see, in Octave only the first character of the transposed string is printed, but for matlab the untransposed and transposed case is the same.

Richard <crobar>


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

Attach Files:

Attached Files
file #36389:  printf-diffs.txt added by jwe (593B - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by crobar (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 project members can vote.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-18 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2016-02-18 jwe StatusPatch Submitted Ready For Test
    2016-02-18 jwe StatusNeed Info Patch Submitted
    2016-02-18 jwe Attached File- Added printf-diffs.txt, #36389
    2016-02-18 mtmiller Item GroupMatlab Compatibility Regression
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code