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

1 回表示 (過去 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 Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by