- Replace "pause()" with a loop that checks for key presses while updating the plot.
- Use "drawnow" to process UI events and keep the interface responsive. Here's a simple implementation:
- Ensure "WindowKeyPressFcn" is set for the " UIFigure" to capture key events.
- drawnow: https://mathworks.com/help/releases/R2021b/matlab/ref/drawnow.html
- pause: https://mathworks.com/help/releases/R2021b/matlab/ref/pause.html