[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cellfun
From: |
Francesco Potortì |
Subject: |
Re: cellfun |
Date: |
Thu, 09 Sep 2010 16:19:42 +0200 |
>>> rfh = @(r) feval (r, 'state', 1);
>>> rfh(@rand)
>>> a = rfh(@rand)
>??? Error using ==> rand
>Too many output arguments.
>
>Error in ==> @(r)feval(r,'state',1)
>
>
>>> cellfun(rfh, {'rand'})
>>> a = cellfun(rfh, {'rand'})
>??? Error using ==> rand
>Too many output arguments.
>
>Error in ==> @(r)feval(r,'state',1)
>
>I think the issue is that octave's cellfun doesn't understand what to do for
>functions that don't return a value. I would file a bug on the tracker.
I sent a mail to Octave bugs list <address@hidden>. But after
doing that, I discovered that one can work around the bug in 3.2.4 by
forcing a return value, like this:
octave> rfh = @(r) zeros (feval (r, "state", 1));
octave> cellfun (rfh, address@hidden, @randn, @rande, @randp, @randg});
--
Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa Email: address@hidden
(entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/
- cellfun, Francesco Potortì, 2010/09/09