bugGNU Octave - Bugs: bug #48092, ind2sub behaves incompatible to...

 
 

bug #48092: ind2sub behaves incompatible to Matlab regarding return values and is insufficiently undocumented

Submitter:  Francesco Potortì <pot>
Submitted:  Thu 02 Jun 2016 11:43:28 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  siko1056
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 11 Jul 2016 11:25:18 AM UTC, comment #4: 

I hijacked this bug report and pushed a cset, that hopefully satisfies the documentation:

http://hg.savannah.gnu.org/hgweb/octave/rev/67a44207da71

Additionally I ensured the Matlab compatibility regarding comment #2. A similar bug #47631 was decided not to fix, I agree on the decision made there.

If there is nothing more to add, I'll close this item.

Kai Torben Ohlhus <siko1056>
Group Member
Tue 05 Jul 2016 02:02:49 PM UTC, comment #3: 

The help starts with "Convert a linear index to subscripts.".

However, the function accepts even more than one linear index. Just using the plural would probably be enough.

Francesco Potortì <pot>
Fri 01 Jul 2016 09:48:28 AM UTC, comment #2: 

I think Francesco means something like


[r, c] = ind2sub ([3, 3], [5, 6; 7, 8])


It is quite standard that Octave accepts matrices as input, even if not clearly stated. But, while testings, I found that Matlab behaves differently when 0 or 1 output arguments are given


>> r = ind2sub ([3, 3], [5, 6; 7, 8])
r =

     5     6
     7     8


that is, IND is returned unchanged.

Marco Caliari <caliari>
Group Member
Thu 02 Jun 2016 02:08:01 PM UTC, comment #1: 
Kai Torben Ohlhus <siko1056>
Group Member
Thu 02 Jun 2016 11:43:28 AM UTC, original submission:  

ind2sub() accepts not only a scalar as an argument, but a matrix too. This is undocumented.

Francesco Potortì <pot>

 

(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 caliari (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by pot (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.

     

    Follow 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-16 siko1056 Open/ClosedOpen Closed
    2016-07-11 siko1056 StatusIn Progress Fixed
    2016-07-11 siko1056 CategoryDocumentation Octave Function
        Severity2 - Minor 3 - Normal
        Priority3 - Low 5 - Normal
        Item GroupDocumentation Matlab Compatibility
        StatusNeed Info In Progress
        Assigned toNone siko1056
        Release4.0.2 dev
        Summaryind2sub accepts a matrix as arg, which is undocumented ind2sub behaves incompatible to Matlab regarding return values and is insufficiently undocumented
    2016-06-03 mtmiller CategoryOctave Function Documentation
    2016-06-02 mtmiller Severity3 - Normal 2 - Minor
    2016-06-02 siko1056 Priority5 - Normal 3 - Low
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code