Automatically set figure position for multiple figures

4 views (last 30 days)
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 Comments
Joep
Joep on 26 Nov 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 on 26 Nov 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

Sign in to comment.

Answers (1)

sanderos
sanderos on 26 Nov 2015
Edited: sanderos on 26 Nov 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.

Categories

Find more on Graphics Performance 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!