bugGNU Octave - Bugs: bug #64783, Default number of output arguments...

 
 

bug #64783: Default number of output arguments not 1 for anonymous functions

Submitter:  Fernando <tutissanalio>
Submitted:  Tue 17 Oct 2023 11:20:18 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 17 Oct 2023 11:20:18 AM UTC, original submission:  

In octave (I tried with default, stable and ver 6.4.0), anonymous functions return multiple output arguments in contexts where normal m-functions return only one:

octave:1> a=struct('re',{1,2},'im',{3,4});
octave:2> a.re
ans = 1
ans = 2
octave:3> f=@(a)a.re;
octave:4> f(a)
ans = 1
ans = 2
octave:5> [f(a)]
ans =
   1   2


This is incompatible with Matlab. In Matlab:

>> a=struct('re',{1,2},'im',{3,4})
a =
  1×2 struct array with fields:
    re
    im
>> f=@(a)a.re
f =
  function_handle with value:
    @(a)a.re
>> f(a)
ans =
     1
>> [f(a)]
ans =
     1


Fernando <tutissanalio>

 

(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 tutissanalio (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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.12