bugGNU Octave - Bugs: bug #37131, string constants handled...

 
 

bug #37131: string constants handled differently than in Matlab (input function doesn't handle newlines correctly)

Submitter:  None
Submitted:  Fri 17 Aug 2012 01:31:58 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.1
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 18 Aug 2012 02:39:39 AM UTC, comment #1: 

This is not a bug but a documented feature in Octave.
See section 5.1 in the Octave manual to see how string
constants are treated differently in Octave with respect
to Matlab.

If you want that code to work as you expect you should rewrite it as


input("some textn", 's')


or, if you want it to work both in Octave AND Matlab, as


input(sprintf('some textn'), 's')




Carlo de Falco <cdf>
Group Member
Fri 17 Aug 2012 01:31:58 PM UTC, original submission:  

I issue the following:


input('some text\n', 's')


and I get

some text\n


rather than the expected


some text


That is, the newline character is treated as text rather than as a newline character.

I have compared with Matlab, and indeed in Matlab I get the latter (expected) behavior. Note that Matlab's help explicitly states that newlines are supported, while Octave's doesn't (and apparently, indeed it doesn't).


I am using Octave 3.6.1, compiled from source on 64-bit Ubuntu 11.10, and Matlab R2010a.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

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 cdf (Posted a comment)
  •  

    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.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-08-18 cdf CategoryNone Interpreter
        Item GroupIncorrect Result Matlab Compatibility
        StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
        Operating SystemGNU/Linux Any
        Summaryinput function doesn\'t handle newlines correctly string constants handled differently than in Matlab (input function doesn't handle newlines correctly)

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code