Change Matlab heap from LIFO to FIFO

3 次查看(过去 30 天)
Óscar
Óscar 2014-11-28
评论: Óscar 2014-12-5
I'm having some troubles with Matlab's heap. The thing is that I'm developing a GUI interface where the user can select a line a move it throughout one axes1 meanwhile in other axes2 some ball move through it depending on the line's position. If the user move the line slowly there is no problem, but if he moves it fast then Matlab catches some of the coordinates and once you stop moving the line it start executing the balls' algorithm (moving them) from the last position to the line to the firs one. As a consequence, the balls don't end on the correct position. I think that it's because Matlab heap is LIFO instead of FIFO, so it would be great if anybody could tell me how to change it, or what I'm doing wrong.
Thanks.
  3 个评论
Geoff Hayes
Geoff Hayes 2014-11-29
Óscar - you may need to post some of your code so that we can get an idea of how the two axes are interacting. It may be that certain events are "piling up" because the first action (moving the line) does not allow itself to be "interrupted" with the moving of the ball on the second axes.
Óscar
Óscar 2014-12-5
Thank you both with your help. Of course, I'm not Matlab expert but that was my assumption.... finally I solved my problem using global variable, as they are always updated with the last position of the line, if another event occurs while moving the ball to the desired position, the final position of them will be the correct one. (Because the global variable has the right position)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by