[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a way to let @ defined function handle return multiple valu
From: |
c. |
Subject: |
Re: Is there a way to let @ defined function handle return multiple values? |
Date: |
Mon, 1 Jul 2013 07:09:48 +0200 |
On 1 Jul 2013, at 05:34, Peng Yu <address@hidden> wrote:
> Hi,
>
> http://www.gnu.org/software/octave/doc/interpreter/Function-Handles.html
>
> I only see @ can be used to define function handles with one return
> value. Is it possible to define a function handle to return two
> values? Thanks.
Yes,
actually there is no such limitation, a function handle
can refer to a function with multiple outputs:
>> function [x,y] = myswap (y,x)
endfunction
>>
>> [a, b] = myswap (1,2)
a = 2
b = 1
>> swaphandle = @myswap
swaphandle = @myswap
>> [a,b]=swaphandle(1,2)
a = 2
b = 1
>>
does the documentation say anywhere anything that makes you think
the opposite? If so can you suggest how to change the documentation to make it
clearer?
HTH,
c.
- Re: Is there a way to let @ defined function handle return multiple values?,
c. <=