[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... ?
Thanks
Neilen
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Assigning to multiple scalars from a vector,
Neilen Marais <=