MATLAB: Use variable in two different functions

matlab gui

I have to use variable defined in one function in another function. What should I use? I tried global but it fails with me

Best Answer

[var1,...]=fcn1(...)
get the variable var1 from fcn1 and use it in fcn2
[...]=fcn2(var1,...)