Automatically set figure position for multiple figures

4 visualizaciones (últimos 30 días)
sanderos
sanderos el 26 de Nov. de 2015
Editada: sanderos el 26 de Nov. de 2015
Hey guys,
is it possible to fix the position of the figures for multiple figures?
I am looking for a command as
set(0, 'DefaultFigurePosition', Pos);
but for multiple windows.
Thanks in advance
  2 comentarios
Joep
Joep el 26 de Nov. de 2015
All in once? or separate?
I should say just
h1=figure %figure1
h2=figure %figure1
set(h1, 'Position', Pos);
set(h2, 'Position', Pos);
U mean like this?
Titus Edelhofer
Titus Edelhofer el 26 de Nov. de 2015
Hi, sorry, I don't understand. Are those figures already open? In this case use
get(0, 'children')
to access an array of all available figures.
Titus

Iniciar sesión para comentar.

Respuestas (1)

sanderos
sanderos el 26 de Nov. de 2015
Editada: sanderos el 26 de Nov. de 2015
Thanks, my question was not specific enough.
I have a script that I run, depending on the computer, to fix the default figure position.
function SetFigPosition(Setting)
% get current figure
% get(gcf, 'Position')
close all;
if Setting == 1 % main screen, upper right side
Pos = [795 359 798 457];
elseif Setting == 2 % main screen, total right side
Pos = [809 39 784 777];
elseif Setting == 3 % second screen, large size
Pos = [1879 -155 1631 971];
elseif Setting == 4 % second screen, middle size
figure(1)
Pos = [2651 214 859 602];
elseif Setting == 5 % main screen, large size, small height
figure(1)
Pos = [10 318 1583 498];
elseif Setting == 6 % second screen, large size, small height
figure(1)
Pos = [1666 266 1729 464];
else
error('This setting is not defined')
end
set(0, 'DefaultFigurePosition', Pos);
% set(1, 'DefaultFigurePosition', Pos);
figure
pause(1); close all;
However, this script is valid for one figure only. If two figures are opened they are just superposed. As I usually work with two or three seperate figures I would like to fix the default behaviour for each figure.

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by