Cannot clear a global variable from inside a function

oxyopes at googlemail.com oxyopes at googlemail.com
Mon Jan 14 11:54:17 CST 2008


Hi friends, look that:

global x=[1 2 3];

function mmm
     global x
     printf("the value of x is %d\n", x)
     clear x; global x
endfunction

mmm
clear x; global x   % clears x outside mmm
x(1)=2;
mmm


The second run of mmm should show only x(1),
since the others were cleared. But no, they aren't cleared.
The manual doesnt mention that. Any tip?

Thanks in advance ...


More information about the Help-octave mailing list