I see a smooth frame rate, but when I measure the frame rate with tic and toc I frequently see unrealistic measurements, like less than one frame per second. I would definitely notice such a frame drop. Below is an extreme example measuring the time for one frame to 16 seconds, but I never saw any stutter.
Can someone help me to ever trust tic toc again, please.
Excerpt from code (simplified)
tic
while j < 1000 && ~quit
aaa = toc;
disp(['Frame rate = ' num2str(1 / aaa)])
if 1 / aaa < 1
disp(aaa)
toc
end
tic
pause(.001)
j = j + 1;
PlotStuff(j)
if strcmp(KEY_EVENT.Key, 'q') % I use a WindowsKeyPress callback.
quit = 1;
end
end
Excerpt from output
Frame rate = 40.9828
Frame rate = 44.1438
Frame rate = 41.395
Frame rate = 30.4108
Frame rate = 29.6011
Frame rate = 40.0793
Frame rate = 32.4089
Frame rate = 42.4079
Frame rate = 0.061352
16.2994
Elapsed time is 16.299732 seconds.
Frame rate = 39.5448
Frame rate = 32.8217
Frame rate = 32.0156
Frame rate = 41.5176

답변 (1개)

Matt J
Matt J 2018년 11월 8일

0 개 추천

Maybe do
PlotStuff(j); drawnow

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2018년 11월 8일

답변:

2018년 11월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by