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

1 Ansicht (letzte 30 Tage)
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 Kommentar
James Van Zandt
James Van Zandt am 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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Rik
Rik am 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'))

Weitere Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by