create_positions(rows, columns)
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
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > Formatting and Annotation > Axes Appearance > Combine Multiple Plots > Subplots >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.