Change Matlab heap from LIFO to FIFO

3 views (last 30 days)
Óscar
Óscar on 28 Nov 2014
Commented: Óscar on 5 Dec 2014
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 Comments
Geoff Hayes
Geoff Hayes on 29 Nov 2014
Ó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 on 5 Dec 2014
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)

Sign in to comment.

Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!