Hi all,
I want to define some global variables in MATLAB GUI. I need to use these variables in all of my callback functions. i have attached the GUI M-File.
it seems that sing the global declaration does not work in this case. i have defined my global variables in line 57-61, but i can not use these variables in line 120.
you should repaet the definition before line 120. you are working in function edit_p0_KeyPressFcn and you defined your global variable in mygui_OpeningFcn
when you want use your global variable define it before your usage.
example
function a;
global var1 = 10;
function b;
global var1;
var2 = var1; ======> its work try it
leotim said:
Hi all,
I want to define some global variables in MATLAB GUI. I need to use these variables in all of my callback functions. i have attached the GUI M-File.
it seems that sing the global declaration does not work in this case. i have defined my global variables in line 57-61, but i can not use these variables in line 120.