reshape

  • reshape(A,dims) transforms matrix A into a matrix with dimensions specified in argument dims where dims is a vector
  • reshape(A,dim1,dim2,...) transforms A into a dim1 x dim2 x ... matrix

Examples

> x = 1:6

	[x:1x6 double]

> reshape(x,2,3)#

	1            3            5
	2            4            6

> reshape(x,[2,3])#

	1            3            5
	2            4            6

> reshape(x,[],3)#

	1            3            5
	2            4            6

Resources

See also

permute | repmat