help-octave
[Top][All Lists]
Advanced

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

Re: varargout{:} = func() ?


From: Ben Abbott
Subject: Re: varargout{:} = func() ?
Date: Wed, 24 Feb 2010 10:29:33 -0500

On Wednesday, February 24, 2010, at 09:59AM, "forkandwait" <address@hidden> 
wrote:
>>   v = cell (expected_outputs, 1);
>>   [v{:}] = func (...);
>> 
>> should work in any recent version of Octave.  
>
>It does.
>
>>   clear v;
>>   [v{:}] = func (...);
>
>Hmm.  But they said it would on the newsgroup ;).  To be fair, they may have 
>assumed that one would know pre-sizing the cell array.
> 
>> will not work, because Octave can't determine nargout for the function
>> call.  I expect this is also true in Matlab.
>
>I guess there is no notation in case one doesn't know the number of expected 
>outputs?  I am just curious at this point.
>

I'm not sure I understand what you're hoping to do. Something like what I 
illustrate below (which doesn't work).

function [a, b, c] = foobar ()
a = 1;
b = 2;
c = 3;
end

v{:} = foobar ()
v =   [1]    [2]    [3]

Ben


reply via email to

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