Reshape 1D to 2D with Balance

version (2.64 KB) by Dr. Murtaza Khan
Reshapes 1D array to 2D array with size of rows and columns of B is balance


Updated 9 Jul 2009

View License

If possible then reshapes 1D array (vector) 'A' into 2D array 'B' such that:
abs(NC-NR) is minimized
NR=number of rows in B
NC=number of columns B
Note: Elements of A are placed column-wise in B.

A simple test program

Cite As

Dr. Murtaza Khan (2022). Reshape 1D to 2D with Balance (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP2
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!