[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: convert vector to cs-list
From: |
Bård Skaflestad |
Subject: |
Re: convert vector to cs-list |
Date: |
Mon, 24 Oct 2011 18:52:53 +0200 |
On Mon, 2011-10-24 at 18:31 +0200, Eric Chassande-Mottin wrote:
> hi,
>
> i'd like to convert a simple vector of double to
> a cs-list but can't find a trick to do that.
> any advice?
>
> cheers, eric
>
> PS: this would things like
> [foo(1:3).bar]=deal(vec2cslist(1:3))
> resulting in
> foo(1).bar=1
> foo(2).bar=2
> foo(3).bar=3
I suggest using Octave's powerful indexing operations which allows
directly subscripting the result of a function call.
[foo(1:3).bar] = num2cell(1:3){:};
Sincerely,
--
Bård Skaflestad <address@hidden>
SINTEF ICT, Applied Mathematics