help-octave
[Top][All Lists]
Advanced

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

Re: extracting value from a vector


From: Alain Baeckeroot
Subject: Re: extracting value from a vector
Date: Tue, 21 Apr 2009 20:19:57 +0200
User-agent: KMail/1.9.9

Le 21/04/2009 à 19:21, John W. Eaton  écrit :
> 
> On 21-Apr-2009, Rob Mahurin wrote:
> 
> | I want this often enough that I've written
> | 
> | function varargout = columns_of (in)
> |    [d1,d2] = size(in);
> |    varargout = mat2cell(in, d1, ones(1,d2) );
> | endfunction
> | 
> | so I can do e.g.
> | 
> | octave> v = rand(2,3), [a,b] = columns_of(v)
> | v =
> |     0.054753   0.509675   0.866045
> |     0.702775   0.483820   0.816340
> | a =
> |     0.054753
> |     0.702775
> | b =
> |     0.50968
> |     0.48382
> 
> See also num2cell, {:}, and deal:
> 
>   v = rand (2, 3), [a, b, c] = deal (num2cell (v, 1){:})
> 
> However, unlike your function, deal requires nargout == nargin.
> 
> jwe
> 
> 

thanks, now i know the adequate octave function, and hand made ones,
 which are better than what i wrote :-)
Alain.




reply via email to

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