help-octave
[Top][All Lists]
Advanced

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

Re: cs-lists and multiple return arguments


From: Jordi Gutiérrez Hermoso
Subject: Re: cs-lists and multiple return arguments
Date: Fri, 28 Oct 2011 15:09:31 -0700

On 28 October 2011 11:45, Przemek Klosowski <address@hidden> wrote:
> On 10/28/2011 02:26 PM, Jordi Gutiérrez Hermoso wrote:
>>
>> I don't understand why this works:
>>
>>     [a,b] = {1, 2}{:}
>>
>> but this doesn't
>>
>>     [a,b] = 1,2
>
> 1,2 is two statements; statement '2' doesn't do much while '1' tries to
> supply both results ('a' and 'b'), and fails.
>
> [a,b] = deal(1,2) works fine---that's what 'deal()' was intended for.

Yeah, I know, but in every other situation I can think of, a cs-list
is syntactically identical to typing out its elements one by one. Why
doesn't that work here? Also, a common use of deal is like this:

    [a b] = deal(c{:})

but

    [a b] = c{:}

makes this completely superfluous. I am curious to know if [a, b] =
c{:} works in Matlab.

Thanks,
- Jordi G. H.


reply via email to

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