MATLAB做苛刻的计算时推迟DISP电话。这是为什么?这是、电话、MATLAB、DISP

2023-09-11 00:12:59 作者:不怕留给时光遗忘

我实现在MATLAB算法。在其他方面,它计算的最短路径等,所以它是相当苛刻的我的旧电脑。我已经把 DISP()调用通过了该方案,看看发生了什么所有的时间。

I am implementing an algorithm in MATLAB. Among other things it calculates the shortest paths etc. so it's quite demanding for my old computer. I've put in disp() calls through out the program to see what's happening all the time.

然而在格外沉重循环启动 DISP()的时候 seemes不要被所谓直到循环结束,尽管它涉及循环之前。这是为什么?我认为,MATLAB是真的顺序执行的还是我只是噎它有太多的计算和 DISP()调用get优先级最低的?

However when starting on a particulary heavy for loop the disp() seemes not to be called until the loop is over even though it comes before the loop. Why is that? I thought that MATLAB was really executing sequentially or am I just choking it with too many calculations and the disp() calls get the lowest priority?

推荐答案

我几乎可以肯定这是因为EDT的。

I am almost certain it is because of EDT.

这就是功能的DrawNow()是。请参见的亚伊尔奥特曼获得很好的解释文章。

That's the function drawnow() is for. See article of Yair Altman for good explanation.

摘要:MATLAB图形就是Java Swing和操作发生在一个特殊的线程 - 事件指派线程(EDT)。呼叫的DrawNow(); 刷新事件队列和更新的身影窗口

Summary: MATLAB graphics is Java Swing and operations happen on a special thread - Event Dispatch Thread (EDT). Calling drawnow(); flushes event queue and updates figure window.