Tic Toc callback problem

조회 수: 7 (최근 30일)
chris
chris 2013년 4월 18일
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 :)

답변 (2개)

Image Analyst
Image Analyst 2013년 4월 18일
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.
  댓글 수: 1
chris
chris 2013년 4월 18일
Ok thanks a lot i'll try this later

댓글을 달려면 로그인하십시오.


per isakson
per isakson 2013년 4월 18일
Your question is vague. Hint:
Somewhere
...
global et
...
'Callback', @the_callback_function
...
where
function the_callback_function( ... )
global et
tic
... some code
et = toc;
end
  댓글 수: 1
chris
chris 2013년 4월 18일
What i mean is tic is outside the callback function , then the toc part is within the callback . Is it possible to do this without affecting the accuracy? Thanks a lot .

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by