Preventing focus theft while running matlab from the command line and creating figures
조회 수: 3 (최근 30일)
이전 댓글 표시
There have been several posts on this subject such as this thread , and proposed solutions such as the program sfigure, but nothing works for me. I'm running R2016b from linux, and opening matlab with the flags
-nosplash -nodesktop
When I run the following code, using @Walter Roberson's fix proposed in the first link
close all;
figure(1);
set(0,'CurrentFigure',1);
plot(1:10);
or using the program `sfigure` suggested in the second link
close all;
sfigure(1);
plot(1:10);
the focus thief remains as active as ever. I would so love to put this thief away for life.
Thanks for any suggestions
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 12월 27일
Creating a figure always gives it focus. The discussion in the other thread is about how to reduce the other circumstances under which the focus might get stolen.
If you set the new figure Visible off and drawnow() almost immediately after you create the figure then you reduce the time during which the focus is at risk. The focus will mostly go back to where it was when you make the new figure visible off, but not necessarily completely reliably. You can reduce the window even more by creating it with visible off: the documentation implies that it would still be temporarily made the current figure in that case, but it can be difficult to tell the cases apart.
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!