필터 지우기
필터 지우기

Under Linux, how do I get a menu of figure windows so I can click to raise one window?

조회 수: 2 (최근 30일)
I have a MATLAB program that creates several dozen figures. On a Mac, the Windows item in the MATLAB menu brings up a list of windows. I've given each figure a meaningful name, so it's easy to click on one to raise it. Under Linux, the desktop manager creates a list of windows, but it's too crowded to show names. Is there a convenient way to select a figure window by name?
  댓글 수: 1
James Van Zandt
James Van Zandt 2023년 4월 24일
Thanks! My version:
function choose
% choose - allow user to raise a figure
h = findobj('Type','figure');
for i=1:numel(h), name{i}=h(i).Name; end
[name,ix]=sort(name); h=h(ix);
while true
for i=1:numel(h), fprintf('%3d %s\n',h(i).Number,h(i).Name); end
n=input('number of figure to raise: ')
for i=1:numel(h)
if h(i).Number == n, figure(n); return; end
end
fprintf('try again\n');
end
Seems like something the OS should provide, though

댓글을 달려면 로그인하십시오.

채택된 답변

Rik
Rik 2023년 4월 21일
If using a code solution is fine, you can use this:
% Create figures with names
f1=figure;
f1.Name = 'foo';
f2=figure;
f2.Name = 'bar';
%%
% Now give focus to the figure with a specific name
figure(findobj('Name','foo'))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by