I have a callback function in my code. I have tried to time from outside the callback function to a point within the callback function using the tic toc function. But it doesn't bring in the tic time into the callback function. How can i do this . I have heard about a function called global can bring variables into a callback but i have not managed to get it done with tic toc? Thanks :)
No products are associated with this question.
Yes. Look at the documentation for tic. Anywhere in your m-file:
global tic; tic1 = tic;
Then in your callback code
global tic1; elapsedTime = toc(tic1);
You can have multiple "Tic"s running simultaneously.
Your question is vague. Hint:
... global et ... 'Callback', @the_callback_function ...
function the_callback_function( ... ) global et tic ... some code et = toc; end
Play games and win prizes!Learn more