Home » All Programs » Reshaping Vectors As Matrices In MatLab(Illustrated Expression)

Reshaping Vectors As Matrices In MatLab(Illustrated Expression)

In some cases again, we need to reshape a vector that includes elements to obtain a matrix, to matrix form in Matlab. There could be some situations to use it. Matlab has a command that do this kind of businnes. So in this text of Mechanicalland, we will show you how to reshape a vector to matrix form in Matlab.

How To Reshape A Vector To Matrix Form In Matlab?

Use of ‘reshape()’ command in Matlab.

To use reshape() command in Matlab, the used vector to create matrix must be fit to row and column number to desired matrix in reshape() like above.

We created a vector called ‘a’ as shown by blue arrow above then we give it a matrix form with reshape() command as shown in blue box above. We want to create a matrix has 5 rows and 3 columns from vector ‘a’. So we typed reshape(a,5,3) command to do it. As you can see above again, the 5×3 matrix is obtained with the elements of ‘a’ respectively.

So use of ‘reshape()’ command to obtain matrices from vectors is very basic in Matlab.

Leave your comments and questions below!

Comments

Leave a Reply

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


Please

leave feedback ?

( For the post )

ASK THE MECHANICALLAND

COMMUNITY


We are always open to your feedback to improve ourselves and the quality of our content! If you have any suggestions, thoughts, or criticism, please let us know. We are trying to improve our blog with constructive feedback. We are aware of how valuable your feedback is for our future development, and we will carefully read all your comments. Thank you in advance!