[Top][All Lists]

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

Update an array

From: afullo
Subject: Update an array
Date: Fri, 29 Aug 2014 13:11:38 -0700 (PDT)

Is there a way to update an array depending on some variables, when these
variables are changed?

For example, I was thinking whether is possible to obtain something like

a = 1;
A = [1 a a^2];
A =

   1   1   1

a = 2;
*update* A;
A =

   1   2   4

In this case it could seem not of much interest (why to use a new command,
while it is sufficient to repeat A = [1 a a^2] ?), but in fact it could be
useful when the definition of A is more complicated (for example, it could
involve more than one variabile, or it could be piecewise).

Thanks in advance.

View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

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