`clear variable` does not work ?

John W. Eaton jwe at bevo.che.wisc.edu
Wed Jan 30 15:32:25 CST 2008


On 30-Jan-2008, Maynard Wright wrote:

| I executed the following script using Octave 2.1.72:

2.1.72 is obsolete.  The current stable version is 3.0.0.  Please
consider upgrading.

| global x = [1 2 3];
| clear x;
| global x = [9 9 9];
| x(3) = 7;
| printf(" x = %d\n", x);
| 
| The result was:
| 
| x = 1
| x = 2
| x = 7
| 
| It seems to me that I can't delete or modify, as a whole, the global variable 
| x, but I can write over individual elements.

To clear the global variable X, you have to write

  clear global x

jwe


More information about the Help-octave mailing list