Position of figure windows - not "stacking"

  • Follow


Is there anyway to get Matlab to evenly space figure windows when they are created? or at least not stack them.

Also If I could have them go to my second monitor, that would be even better

Will
0
Reply William 12/9/2010 5:08:05 PM

On 09/12/10 11:08 AM, William wrote:
> Is there anyway to get Matlab to evenly space figure windows when they
> are created? or at least not stack them.
>
> Also If I could have them go to my second monitor, that would be even
> better

Yes, you could create a root property for the DefaultFigureOpenFcn and 
set it to a function that used findall(0,'Type','figure') to determine 
the existing figure locations; get() their Position properties and 
figure out where there is some free screen real-estate and set() the 
figure Position to be there.

You can get(0,'MonitorPosition') to determine the positions of your 
monitors (though apparently on Windows there tends to be errors in what 
is reported for multiple monitors.)

There is no Matlab setting that tells it how to space new figures apart 
from each other: on the contrary, there is a setting to tell it the 
exact (constant) coordinates to put figures at by default.

The closest you might possibly get to automatic positioning is if you 
set your preferences so that figures were docked in the desktop. I don't 
know the mechanics of that as I personally prefer undocked figures.
0
Reply Walter 12/9/2010 5:32:53 PM


Hi William,

There is a way you can get the figure windows to tile/overlap using code in 
a MATLAB script or function.
Please try the following:

left = 100;
top = 600;
width = 500;
height = 300;

delta = 40;

basePos = [ left, top, width, height ];
offset = [ delta, -delta, 0, 0 ];

N = 5;
fig = zeros(N,1);
ax = zeros(N,1);

for k = 1:N
    fig(k) = figure('position',basePos + (k-1)*offset);
    ax(k) = axes;
end

plot(ax(1),randn(10,1));
stem(ax(2),randn(20,1));
....
....

HTH.

Rick



"William " <willjhenry@gmail.com> wrote in message 
news:idr2dl$9j$1@fred.mathworks.com...
> Is there anyway to get Matlab to evenly space figure windows when they are 
> created? or at least not stack them.
>
> Also If I could have them go to my second monitor, that would be even 
> better
>
> Will
> 
0
Reply Rick 12/9/2010 6:25:10 PM

2 Replies
185 Views

(page loaded in 0.312 seconds)

Similiar Articles:













7/9/2012 11:35:58 AM


Reply: