bugGNU Octave - Bugs: bug #38151, Empty length in a linspace


bug #38151: Empty length in a linspace

Submitted by:  Marco Caliari <caliari>
Submitted on:  Wed 23 Jan 2013 02:04:47 PM UTC  
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  3.6.2 Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

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


Thu 21 Feb 2013 12:31:43 AM UTC, comment #2:

It's not documented, but apparently Matlab produces B for linspace (A, B, []). It would not be hard to fix this, so I say why not? I checked in the following change:


John W. Eaton <jwe>
Project Administrator
Wed 20 Feb 2013 11:48:18 PM UTC, comment #1:

I think that Octave probably has the correct behavior.

According to the linspace documentation it wants a scalar number N for the number of points. The empty matrix is not zero (a scalar number), but an entirely different data type (matrix). It seems fine to flag the user that linspace has been called incorrectly. The error message also points out

error: linspace: N must be an integer

which gives a good clue about what a user would need to do to make it work.

Rik <rik5>
Project Administrator
Wed 23 Jan 2013 02:04:47 PM UTC, original submission:

Dear maintainers,

what should be the result of

Actually (3.6.2), it is an error. If I consider the following case

the last two lines give the same result [3,4]. But if I consider
the same example with

the second last line works (although giving the transposed result [](0x1)) and the last line does not work.
If I do the same in Matlab, I get [](1x0) and error, respectively.
I do not know what "should" be the result and, of course, it is a corner case.


Marco Caliari <caliari>
Project Member


(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 jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by caliari (Submitted the item)

    Do you think this task is very important?
    If so, you can 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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    Thu 21 Feb 2013 12:31:43 AM UTC jwe Item GroupFeature Request => Matlab Compatibility
        StatusWont Fix => Fixed
    Wed 20 Feb 2013 11:48:18 PM UTC rik5 StatusNone => Wont Fix
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.3