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 CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by