octave-maintainers
[Top][All Lists]
Advanced

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

Re: request test in Matlab, cellfun and anonymous functions with > 1 out


From: Olaf Till
Subject: Re: request test in Matlab, cellfun and anonymous functions with > 1 outputs
Date: Wed, 23 Jul 2014 21:20:36 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jul 23, 2014 at 05:17:41PM +0200, Julien Bect wrote:
> Le 23/07/2014 11:17, Olaf Till a écrit :
> > <snip>
> >
> > So it returns a syntax error? I meant to provide a simple anonymous
> > function which returns two outputs ... Maybe this is again the
> > impossibility to index each expression in Matlab ... so what does it
> > with these:
> >
> > octave:1> tp = {1, 1}
> > tp =
> > {
> >   [1,1] =  1
> >   [1,2] =  1
> > }
> > octave:2> [a, b] = cellfun (@ (x) tp{:}, {1})
> > error: cellfun: function returned fewer than nargout values
> > octave:2> a = @ (x) tp{:}
> > a =
> >
> > @(x) tp {:}
> >
> > octave:3> a(5)
> > ans =  1
> > ans =  1
> 
> >> tp = {1, 1}
> 
> tp =
> 
>     [1]    [1]
> 
> >> [a, b] = cellfun (@ (x) tp{:}, {1})
> 
> a =
> 
>      1
> 
> 
> b =
> 
>      1
> 
> >> a = @ (x) tp{:}
> 
> a =
> 
>     @(x)tp{:}
> 
> >> a(5)
> 
> ans =
> 
>      1

Thanks a lot, so I'll probably file a bug.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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