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

1 view (last 30 days)
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 Comment
James Van Zandt
James Van Zandt on 24 Apr 2023
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

Sign in to comment.

Accepted Answer

Rik
Rik on 21 Apr 2023
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'))

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!