Skip to main content
23-Emerald V
June 20, 2012
Question

reshape anything! (well, reshape some things)

  • June 20, 2012
  • 0 replies
  • 1736 views

Attached is a variant of a reshape function that will reshape a vector, matrix or nested array in to a vector, matrix or (regularly structured) nested array depending upon the value of a shape vector.

Usage is reshape(A,n) (n-vector), reshape(A,[n]) (n-vector), reshape(A,[m,n]) (mxn matrix), reshape(A,[k,l,m,n] (mxn matrix of kxl matrices)

Stuart