octave-maintainers
[Top][All Lists]
Advanced

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

Re: structfun: more than one output argument


From: Jaroslav Hajek
Subject: Re: structfun: more than one output argument
Date: Tue, 19 Jan 2010 10:10:50 +0100

On Mon, Jan 18, 2010 at 10:53 PM, Thorsten Meyer <address@hidden> wrote:
> Hi
>
> John W. Eaton wrote:
>> On 17-Jan-2010, Thorsten Meyer wrote:
>>
>> | here is a patch to extend the capability of cellfun of handling more than 
>> one
>> | output argument to structfun. This will make structfun more matlab 
>> compatible.
>>
>> Maybe I'm missing something, but the new test you added already passes
>> without the change.  So can you send an example of something that
>> should work but fails without your patch?
>>
> You have been quite right (and there still was a typo in the code).
> structfun has already been able to handle multiple output arguments with
> the (default) "uniformoutput", true option - but not for
> "uniformoutput", false.
>

I should note that that the iscell (varargout{1}) is not sufficient to
check for the uniform output case. Consider
cellfun (@(x) {x}, {1, 2, 3}, "uniformoutput", true) - the result is
still a cell.

I pushed a different solution that really checks for the option, and
also replaced the loop by a second cellfun call.
I added all of your tests, which are now passing.
http://hg.savannah.gnu.org/hgweb/octave/rev/aa0f575cf39b

thanks

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



reply via email to

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