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

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

[Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wr


From: Rik
Subject: [Octave-bug-tracker] [bug #58411] cellfun with "ErrorHandler" returns wrong message
Date: Mon, 1 Jun 2020 18:36:56 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #2, bug #58411 (project octave):

This bug has two parts.  The fact that the last value has nonsense in it,
rather than NaN, is due to the "ErrorHandler" routine itself.  The function
"foo" cycles over the range 1:nargout.  However, when the calling form is 


cellfun (...)


nargout is equal to 0 so no value is assigned by the ErrorHandler.  This is
why the invocation


x = cellfun (...)


works because nargout is equal to 1 in this case and the for loop works
correctly.

However, what should happen, according to Matlab, is that an error gets thrown
because the function is supposed to supply a value.  Matlab emits an error
that says that "UniformOutput" is true (default) but the function failed to
produce a value for index 3.

By setting "UniformOutput" to false, both Matlab and Octave produce the
correct result


cellfun (@factorial, {1,2,-3}, "ErrorHandler", @cellfoo, 'uniformoutput',
false)




    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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