create_positions(ro​ws, columns)

Version 1.3.0.0 (4.14 KB) by Bas K
create_positions creates outerposition vectors for desired figure grid
196 Downloads
Updated 17 Mar 2015

View License

CREATE_POSITIONS creates outerposition vectors for desired figure grid
function position = create_positions(rows, columns)
INPUT
rows: Vector of desired number of rows per monitor
columns: Vector of desired number of columns per monitor
OUTPUT
position: Array with desired outerposition vectors
B. van de Kerkhof, September 2014
------------------------------------------
EXAMPLE 1
desired: A 5 by 4 grid for figures
position = create_positions(5, 4);
position is a 20 by 4 matrix containing the position vectors.
numbering of positions is top to bottom left to right.

------------------------------------------

EXAMPLE 2
desired: A 5 by 4 grid for figures on the second screen
position = create_positions([0 5], [0 4]);
position is a 20 by 4 by 2 array containing the position vectors.
position(:,:,1) is an array containing only nan's
position(:,:,2) contains the position vectors for the second screen

------------------------------------------

EXAMPLE 3
desired: A 5 by 4 grid for figures on the first screen, a 3 by 7 grid for
figures on the second screen and a 3 by 3 grid for figures on the third
screen.
position = create_positions([5 3 3], [4 7 3]);
position is a 21 by 4 by 3 array containing the position vectors.
position(1:20,:,1) contains the position vectors for the first screen
position(1:21,:,2) contains the position vectors for the second screen
position(1:9,:,3) contains the position vectors for the third screen

------------------------------------------

WORKING EXAMPLE
position = create_positions([5 3], [4 7]);

for i = 1:20
set(figure, 'Outerposition', position(i,:,1))
end

for i = 1:21
set(figure, 'Outerposition', position(i,:,2))
end

Hence we get a 5x4 grid of figures on monitor 1 without overlapping the
taskbar and a 3x7 grid of figures on monitor 2.

Cite As

Bas K (2024). create_positions(rows, columns) (https://www.mathworks.com/matlabcentral/fileexchange/47812-create_positions-rows-columns), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.3.0.0

Also updated the examples in the comments of the actual file

1.2.0.0

Updated the example with the correct function name

1.1.0.0

Bug fix when only input for less monitors than available is given.

1.0.0.0