O'Reilly logo

MATLAB® and Its Applications in Engineering: [Based on MATLAB 7.5 (R2007b)] by Manoj Kumar Sharma, Ashok Kumar Goel, Raj Kumar Bansal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.7. Matrix Manipulations

The shape and size of a matrix can be altered by using the following MATLAB commands:

3.7.1. Reshaping Matrices

Matrices can be reshaped into a vector or into any other appropriately sized matrix as described below:

3.7.1.1. Reshaping of a Matrix as a Vector

All the elements of a matrix A can be grouped into a single column vector b by the command b = A(:). Matrix A will be stored column wise in vector b i.e. first column is stored first, then second column and so on.

Example 3.7.

Let matrix . Reshape the matrix to a column vector.

Solution:

The command

A=[1 10 20; 2 5 6 ;7 8 9]

The following result is displayed: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required