How to use global variables in an octave:
tmp.m .
global x; %make a global variable called x
x = 5; %assign 5 to your global variable
tmp2(); %invoke another function
tmp2.m :
function tmp2()
%the following line is not optional, it tells this function go go out and get
%the global variable, otherwise, x will not be available.
global x
x
end
:
octave tmp.m
:
x = 5
x tmp.m tmp2.m