MATLAB Reshape

reshape() command or function reshapes a matrix or vector, after reading this MATLAB Reshape topic, you will know the theory and examples.


Syntax:

reshape(n,a,b)

  • n is a matrix or vector.
  • a is numbers of rows.
  • b is numbers of columns.

Example: To reshape a vector into the matrix.

Output:

n =

1  2  3  56


ans =

1   3
2   56

Example: To reshape a matrix into another matrix.

Output:

n =

     2     3
     2     1
     5     1


ans =

     2     5     1
     2     3     1

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!
Scroll to Top