[Top][All Lists]

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

Assigning to multiple scalars from a vector

From: Neilen Marais
Subject: Assigning to multiple scalars from a vector
Date: Wed, 22 Dec 2004 18:20:14 +0200

Hi All.

I'd like to be able to assign to several scalar variables from a vector
in one shot.  Say I have a vector like this :
vec = [1 ; 2 ; 3]

I would like to be able to do something like this:

[A ; B ; C] = vec

and get A = 1, B = 2, C = 3.

Octave seems to consider the individual scalars as vectors, so there
aren't enough elements on the RHS according to it. Is there a way to
make this work, or will I have to manually say A = vec(1) etc... ?


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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