On Wed, Jul 7, 2010 at 1:54 PM, Jean-Benoist Leger <le...@crans.org> wrote:
> When we use cellfun without return argument we have a result, but with
> parcellfun we don't have any result because nargout==0 :
>
>> octave:1> f = @(x) x^2;
>> octave:2> X = num2cell (1:10);
>> octave:3> cellfun(f,X)
>> ans =
>>
>>      1     4     9    16    25    36    49    64    81   100
>>
>> octave:4> parcellfun(5,f,X)
>> parcellfun: 10/10 jobs done
>> octave:5>
>
> So I propose a patch.
>

No, this would mean going backwards. parcellfun should preserve the
value of nargout for the callback, in order to not change its call
signature (some functions return no values). I've been long aware of
the problem; cellfun used to behave exactly this way until I fixed it
last year. See 
http://octave.1599824.n4.nabble.com/changes-in-cellfun-td1657119.html#a1657119
for further explanation. This is actually a design inconsistency in Matlab.
It can be worked around in C++ (and cellfun does exactly that), but
unfortunately not in m-file. I think the current behavior is the
lesser of two evils. Just do "ans = parcellfun (...)" and try to live
with it. Maybe in the future Octave will improve on Matlab by fixing
this inconsistency, your example will then start to work
automatically.

best regards

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to