getRowsCols(N,longD​im)

Version 1.0.0.0 (1018 Bytes) by Shannon Locke
Calculates the number of rows and columns for square figure with subplots
25 Downloads
Updated 8 Aug 2016

View License

This function number of rows and columns for subplots where you want the final figure to be as square as possible. If one dimension is going to be longer than the other, you can specify if you want this to be the rows or columns with the 'longDim' argument (default is columns).
E.g.
[R,C] = getRowsCols(5) gives R=2, C=3.
[R,C] = getRowsCols(9) gives R=3, C=3.

Cite As

Shannon Locke (2025). getRowsCols(N,longDim) (https://se.mathworks.com/matlabcentral/fileexchange/58605-getrowscols-n-longdim), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0