十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
本篇文章为大家展示了Matlab Timer回调函数的执行中rawnow函数的用途是什么 ,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
创新互联是一家集网站建设,富裕企业网站建设,富裕品牌网站建设,网站定制,富裕网站建设报价,网络营销,网络优化,富裕网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。由前一篇文章可以看出,按照所设定的时间间隔调用Timer的回调函数时,并不是真的即刻执行该回调函数,而是先将该回调函数放入事件队列中,待前面的事件都执行完时才执行该事件。但有时我们需要当所设定的时间到达时立刻执行我们的回调函数,此时我们就可以用功能强大的drawnow函数了。在回调函数中加入drawnow就可以在时间到达时强制执行该回调函数。
下面给出的是matlab帮助里关于drawnow的用法:
drawnow
Flush event queue and update figure window
Syntax
drawnow
drawnow expose
drawnow update
Description
drawnow causes figure windows and their children to update and flushes the system event queue. Any callbacks generated by incoming events (e.g. mouse or key events) are dispatched before drawnow returns.
drawnow expose causes only graphics objects to refresh, if needed. It does not allow callbacks to execute and does not process other events in the queue.
drawnow update causes only non-graphics objects to refresh, if needed. It does not allow callbacks to execute and does not process other events in the queue.
You can combine the expose and update options to obtain both effects.
drawnow expose update
Other Events That Cause Event Queue Processing
Other events that cause MATLAB to flush the event queue and draw the figure includes:
*
Returning to the MATLAB prompt
*
Executing the following functions
o
figure
o
getframe
o
input
o
keyboard
o
pause
*
Functions that wait for user input (i.e., waitforbuttonpress, waitfor, ginput)
*
Any code that causes one of the above functions to be executed. For example, suppose h is the handle of an axes. Calling axes(h) causes its parent figure to be made the current figure and brought to the front of all displayed figures, which results in the event queue being flushed.
Examples
Using drawnow in a loop causes the display to update while the loop executes:
t = 0:pi/20:2*pi;
y = exp(sin(t));
h = plot(t,y,'YDataSource','y');
for k = 1:.1:10
y = exp(sin(t.*k));
refreshdata(h,'caller') % Evaluate y in the function workspace
drawnow; pause(.1)
end
上述内容就是Matlab Timer回调函数的执行中rawnow函数的用途是什么 ,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注创新互联行业资讯频道。