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

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

[Octave-bug-tracker] [bug #66642] cellfun assumes zero values when funct


From: Fernando
Subject: [Octave-bug-tracker] [bug #66642] cellfun assumes zero values when function returns fewer outputs than expected
Date: Mon, 6 Jan 2025 06:28:30 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?66642>

                 Summary: cellfun assumes zero values when function returns
fewer outputs than expected
                   Group: GNU Octave
               Submitter: tutissanalio
               Submitted: lun 06 ene 2025 11:28:26
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Missed Error or Warning
                  Status: None
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: stable
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: lun 06 ene 2025 11:28:26       By: Fernando <tutissanalio>
In current stable and default branches, cellfun incorrectly assigns a value of
zero for values not returned by the called function, when the function returns
fewer outputs than declared.


octave:> ver octave
----------------------------------------------------------------------
GNU Octave Version: 9.3.1 (hg id: 81462b707b37)
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]=cellfun(@f,{1,4})
a =
   1   4
b =
   0   0


Instead, I would expect an error, like the one you get when calling the
function directly:


octave:> [a,b]=f(1)
a = 1
error: element number 2 undefined in return list









    _______________________________________________________

Reply to this item at:

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

_______________________________________________
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]