You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
[nr nc] = BestArrayDims(n)
Given n elements, BestArrayDims returns the dimensions of an array in which to store them. The function also accepts user preferences as to whether they require less wasted space or a more square configuration.
I have found this function particularly well-suited for finding subplot dimensions if it is not known in advance the number of plots that will be needed.
Cite As
Zachary Danziger (2026). BestArrayDims (https://www.mathworks.com/matlabcentral/fileexchange/30561-bestarraydims), MATLAB Central File Exchange. Retrieved .
Acknowledgements
Inspired by: numSubplots - neatly arrange subplots
General Information
- Version 1.0.0.0 (2.04 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 |
