Is there a way to declare global variables in MATLAB?
Please don't respond with:
global x y z;
Because I can also read the help files.
I've declared a global variable, x
, and then done something like this:
function[x] = test()
global x;
test1();
end
Where the function test1()
is defined as:
function test1()
x = 5;
end
When I run test()
, my output is x = []
. Is there a way I can make it output the x=5
, or whatever I define x
to be in a separate function? In C, this would be an external variable, and I thought making it a global variable should accomplish just that.
question from:
https://stackoverflow.com/questions/4911926/declaring-a-global-variable-in-matlab 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…