- If a 'WindowButtonDownFcn' is defined for the figure, it executes before 'waitforbuttonpress' returns a value.
- The 'waitforbuttonpress' function errors if the user closes the figure by clicking the window close button unless your code calls the waitforbuttonpress function within a try/catch block.
Problema con plot di dati, ricevo il messaggio "In workspace belonging to" e la compilazione non procede
1 view (last 30 days)
Show older comments
Ho scritto un codice in cui viene creata una figure tramite un plot e successivamente dentro un ciclo for vado a modificare YData del plot, prima del ciclo for ho messo waitforbuttonpress e quando la compilazione arriva a quel punto del codice nella Command Window compare: "In workspace belonging to (nome del file) ". La compilazione si ferma e non prosegue neanche cliccando sul pulsante Continue.
0 Comments
Answers (1)
Tushar Sharma
on 18 Mar 2024
Hi Giovanni,
It sounds like you're encountering an issue where MATLAB's execution pauses due to 'waitforbuttonpress' and doesn't resume as expected when you interact with the figure or press a button. The behaviour you are describing, particularly the execution not continuing even after pressing "Continue", is not standard and might indicate an issue with how the event is being handled or the expected function's behavior.
Some important points to consider when using 'waitforbuttonpress':
Also, To resume program execution after the 'waitforbuttonpress' function is called, a click or key press must occur in the current figure, and not just any figure. This change in behavior was introduced in order to prevent program execution from proceeding in an unintended figure. Prior to R2014b, 'waitforbuttonpress' would detect a click or key press event in any open figure. The execution stream would then resume in the figure in which the event was detected.
I hope this helps!
3 Comments
Tushar Sharma
on 19 Mar 2024
Edited: Tushar Sharma
on 19 Mar 2024
Can you please share the code snippet here?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!