help-octave
[Top][All Lists]
Advanced

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

Indirect Addressing Question


From: Hartmut Henkel
Subject: Indirect Addressing Question
Date: Tue, 13 Nov 2001 22:37:35 +0100 (CET)

Please excuse the following newbie question:

With

a = [1 1 1 1 1]
q = [1 1 1 2 2]

the following

a(q(1:5)) = a(q(1:5)) + 10

gives

a = 11 11 1 1 1

But I would expect

a = 31 21 1 1 1

which I get by running the loop

for i = 1 : 5
  a(q(i)) = a(q(i)) + 10
endfor

It seems that such indirect addressing is not allowed. Is there a trick
to circumvent the for-loop?

Greetings Hartmut



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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