hi, look this code::
function Test()
global b;
b=4;
A();
b
function A()
b=7;
endfunction
endfunction
>> Test
error: 'b' undefined near line 8 column 1
error: called from
Test at line 8 column 1
I need to use variables global but i see i loss reference variables
Your example works in Matlab R2019a Update 1, but not in Octave 5.1.0. In Octave 6 (the current development version) it will work, thanks to great efforts by jwe and others improving the interpreter. Thus there is no need to report a bug about it. I think you have two options:
1. Wait for Octave 6 (maybe next year).
2. Refactor your code to use subfunctions instead of nested functions [1] if possible. The following works in Octave 5.1.0:
----- File Test.m -----
function Test()
global b;
b=4;
A();
b
endfunction
function A()
global b;
b=7;
endfunction
------------------------------
HTH,
Kai