bugGNU Octave - Bugs: bug #67426, Allow Map subsref method to return...

 
 

bug #67426: Allow Map subsref method to return multiple outputs

Submitter:  Fernando <tutissanalio>
Submitted:  Wed 13 Aug 2025 06:53:28 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Wed 13 Aug 2025 07:10:02 PM UTC, comment #1: 

Here's the patch. This requires also the patch proposed for bug #67403, not yet applied (otherwise, nargout for subsref will be 1, and it will not work).

(file #57530)

Fernando <tutissanalio>
Wed 13 Aug 2025 06:53:28 PM UTC, original submission:  

Currently, Map subsref method always returns one output, which is incorrect in some cases like the following:

octave:1> M = containers.Map ('first', struct ('dat', {111, 222}));
octave:2> [a, b] = M ('first').dat;
error: element number 2 undefined in return list

In Matlab, I get:

>> M = containers.Map ('first', struct ('dat', {111, 222}));
>> [a, b] = M ('first').dat
a =
   111
b =
   222


Other similar examples (not valid in Matlab because indexing in Matlab is more restrictive):

octave:1> M = containers.Map ('first', {{111, 222}});
octave:2> [a, b] = M ('first') {:};
error: element number 2 undefined in return list
octave:3> M = containers.Map ({'first', 'second'}, {111, 222});
octave:4> [a,b] = M.values () {:};
error: element number 2 undefined in return list


I will submit a patch for this, once I know the bug number.

Fernando <tutissanalio>

 

Attached Files

Attached Files
file #57530:  bug67426.cset added by tutissanalio (1.8KiB - application/octet-stream)

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

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

    Votes

    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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-08-13 tutissanalio Attached File- Added bug67426.cset, #57530

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code