help-octave
[Top][All Lists]
Advanced

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

Re: Variable number of function return values


From: David Bateman
Subject: Re: Variable number of function return values
Date: Fri, 02 Jun 2006 10:02:05 +0200
User-agent: Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322)

Gregor Beck wrote:
> Hi,
> 
> I try to get a variable number of return values from a function.
> With matlab something like this does the trick:
> 
> C = cell(1, 4);
> [C{:}] = fileparts('work/mytests/strArrays.mat')
> 
> C =
> 'work/mytests' 'strArrays' '.mat' ''
> 
> But with octave (2.9.5 & 2.1.44) I get
> 
> C =
> {
>   [1,1] = work/mytests
>   [1,2] = work/mytests
>   [1,3] = work/mytests
>   [1,4] = work/mytests
> }
> 
> Is this the intended behavior?
> Is there another way to achieve this?
> 
> thanks,
> Gregor


This one has been on the TODO list for at least 4 years. I believe the
matlab behaviour is still planned for Octave 3. Till then the only way I
see around this is explicitly state the return elements as

C = cell(1,4);
[C{1}, C{2}, C{3}, C{4}] = fileparts('work/mytests/strArrays.mat');


D.




reply via email to

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