Why do I get an error message saying 'Invalid handle' ?

21 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 27 Fév 2012
Why do I get the following error message :
ERROR: Invalid Handle

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 12 Oct 2021
Modifié(e) : MathWorks Support Team le 17 Nov 2021
Explanation:
You are using Handle Graphics commands to try to manipulate a handle to an object that no longer exists.
Common causes:
You have removed the Handle Graphics object from the figure or GUI before attempting to manipulate it using SET or GET . Another common cause is creating objects inside a for loop without turning HOLD on; this frequently occurs using the PLOT function.
Solution:
Stop MATLAB on the line where the error occurs. Verify that the reference you are using is to an existing Handle Graphics object by backtracking in the code to the statement that created the Handle Graphics object. Also verify that the line, which was intended to create the object, did so by setting a breakpoint on it and executing the function again. The FINDALL, FINDOBJ, ALLCHILD, and ISHANDLE functions allow you to find the handles of objects and verify that the objects exist.
Example demonstrating this error:
InvalidHandle.m

Plus de réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by