octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #66617] structfun assumes output arguments for


From: Fernando
Subject: [Octave-bug-tracker] [bug #66617] structfun assumes output arguments for invoked command
Date: Sun, 5 Jan 2025 08:09:36 -0500 (EST)

Follow-up Comment #13, bug #66617 (group octave):

While testing for this issue, I noticed a case that should produce an error
but does not (in current default branch).



octave:> ver octave
----------------------------------------------------------------------
GNU Octave Version: 10.0.0 (hg id: 462e19654ec9)
GNU Octave License: GNU General Public License
Operating System: Linux 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu
Dec  5 13:09:44 UTC 2024 x86_64
----------------------------------------------------------------------
octave:> function [a,b]=f(x);a=x;end
octave:> s = struct ("a", 1, "b", 4);
octave:> [a,b]=structfun(@f,s)
a =
   1
   4
b =
   0
   0


I expected an error, because variable b should not have been given any value.
In Matlab, you get an error:

Output argument "b" (and possibly others) not assigned a value in the
execution with "ff_ab" function. 

It looks like the problem is in cellfun:

octave:13> [a,b]=cellfun(@f,{1,4})
a =
   1   4
b =
   0   0


I can file a bug report for that.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66617>

_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]