global m = 1; function p = h() m end h() I'm trying to run this script, but I get this error:
'm' undefined near line 4 column 3
Say me please, how I can use the variable from functions?
global m = 1; function p = h() m end h() I'm trying to run this script, but I get this error:
'm' undefined near line 4 column 3
Say me please, how I can use the variable from functions?
You have to declare the var also global inside the function as described here: https://www.gnu.org/software/octave/doc/interpreter/Global-Variables.html
global m = 1; function p = h() global m; m endfunction h()