|
From: | Michal Studniarek |
Subject: | Re: global variables |
Date: | Tue, 21 Jan 2014 18:01:40 +0100 |
On Tue, Jan 21, 2014 at 17:39:35 +0100, Michal Studniarek wrote:In fact your example is almost exactly out of the manual and shows
>
> I think the question was if you can define a global variable then change
> its value inside function and to have a new value available outside.
>
> In example:
>
> global x=2;
>
> function x=test()
> global x;
> x=4;
> endfunction
>
> Value of global variable x will be still 2. Function operates on global var x
> locally but can not change its value globaly.
that a function can indeed modify the value of a global variable, both
inside and outside the scope of the function.
See https://www.gnu.org/software/octave/doc/interpreter/Global-Variables.html
--
mike
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave
[Prev in Thread] | Current Thread | [Next in Thread] |