MATLAB: Define function that includes number of variable and call it in many callback function in GUI

functionguiMATLAB

Hi Sorry question maybe not clear so i add more details about my problem.
I have a problem in my GUI, the problem is i have 5 variables that i defined them and i use them many times in my code because they define for me important parameters. so I would like to write them in one function then i will recall the function in the wanted callback functions in order to simplify my code.
Thanks in advance

Best Answer

Let's assume you have defined these variables. a = 2; b = 7; c = 15; Name = 'My Name'; Age = 105; To make sure that these are defined exactly as they are in a calling function we can then define our callee as:
function get_variables()
command = ['a=2;b=7;c=15;Age=135;Name=''My Name'';'];
evalin('caller',command);
end