how to use a variable returned from one callback function in an other callback funtion in GUI??

1 view (last 30 days)
I have two functions called sum1_Callback and disp_Callback
function c=sum1_Callback(hObject, eventdata, handles) c= 2*2;
function disp_Callback(hObject, eventdata, handles,c) disp(c)
In sum_Callback, I have a variable c which I want to use in disp_Callback, but I get an error telling the variable is undefined.
What should be done??
Thanks in advance for the help.

Answers (1)

Walter Roberson
Walter Roberson on 13 Sep 2013
There are no callbacks that take eventdata as the second parameter and return values. The only callbacks that return values are the ones that are acting as filters, such as a constraint function programmed to ensure that a rectangle selection retains a particular proportion.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!