How do I stop figures from stealing focus without having to create a global variable?
Mostrar comentarios más antiguos
I'm running nonlinear FE analysis and adding load/displacement points for every iteration using animated line. The function that does the plotting right now does not have access to the figure handle, but I do know the figure number, so I end up having to use figure(1). The problem is figure() will by default make the image pop, which prevents me from doing anything on the computer while the code is running. I've seen some answers to similar questions saying that this should be used:
set(0,'CurrentFigure',figHandle);
But right now, unless I make the figure handle global or pass it to every function until it gets to where I need it to be I can't use this structure. Is there a work around this? Maybe using tags on the figures?
Respuestas (1)
Steven Lord
el 4 de Feb. de 2019
Are you're sharing the handle to the graphics object that you're updating among the functions that update it? If so, ask that object what its ancestor figure is. Assuming h is the handle to the graphics object, f is its ancestor figure.
f = ancestor(h, 'figure')
But I'm curious -- why do you need to do anything with the figure handle?
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!