Getting Started Previous page   Next Page

Deleting Rows and Columns

You can delete rows and columns from a matrix using just a pair of square brackets. Start with

Then, to delete the second column of X, use

This changes X to

If you delete a single element from a matrix, the result is not a matrix anymore. So, expressions like

result in an error. However, using a single subscript deletes a single element, or sequence of elements, and reshapes the remaining elements into a row vector. So

results in


Previous page  Concatenation More About Matrices and Arrays Next page

© 1994-2005 The MathWorks, Inc.