How do I stop figures from stealing focus without having to create a global variable?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (1)
Steven Lord
am 4 Feb. 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?
2 Kommentare
Jess
am 11 Jan. 2021
I have a similar question. I can't speak for why the OP needs the figure handle, but I send the figure handle to a routine that beautifies and saves the figure in a specified format.
Siehe auch
Kategorien
Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!