How to retrieve intermediate variables from a callback function?
Show older comments
Hi,
I was working on the app designer in matlab which has 3 buttons. For the first two buttons it prints the entrance time and exit time as sprint variables which are extracted from the clock function once the button is clicked. I want to use the two variables when the clock function is used to subtract them when the third button is clicked.
%Button1 button pushed function
function Button1ButtonPushed(app)
A1 = clock;
fix(A1)
E1 = sprintf('\n%2.0f:%2.0f:%2.0f',A1(4),A1(5),A1(6));
app.Enter1.Value = E1;
end
% Button2 button pushed function
function Button2ButtonPushed(app)
B1 = clock;
fix(B1)
S1 = sprintf('\n%2.0f:%2.0f:%2.0f',B1(4),B1(5),B1(6));
app.Exit1.Value = S1;
end
% Button3 button pushed function
function Button3ButtonPushed(app)
T = etime(B1,A1);
end
Accepted Answer
More Answers (0)
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!