Programming |

**Diminishing the Size of a Matrix**

You can delete rows and columns from a matrix by assigning the empty array `[]`

to those rows or columns. Start with

Then, delete the second column of `A`

using

If you delete a single element from a matrix, the result isn't a matrix anymore. So expressions like

result in an error. However, you can use linear indexing to delete a single element, or a sequence of elements. This reshapes the remaining elements into a row vector:

Resizing and Reshaping Matrices | Reshaping a Matrix |

© 1994-2005 The MathWorks, Inc.