This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Delete matrix rows

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


linalg::delRow(A, r)
linalg::delRow(A, r1 .. r2)
linalg::delRow(A, list)


linalg::delRow(A, r) returns a copy of the matrix A in which the row with index r is deleted.

linalg::delRow(A, r1.. r2) deletes those rows whose indices are in the range r1.. r2. If r2< r1 then the input matrix A is returned.

linalg::delRow(A, list) deletes those rows whose indices are contained in list.

If all rows are deleted then NIL is returned.


Example 1

We define the following matrix:

A := matrix([[1, 2], [3, 4], [5, 6], [7, 8]])

and illustrate the three different input formats for linalg::delRow:

linalg::delRow(A, 2)

linalg::delRow(A, [1, 4])

linalg::delRow(A, 2..4)



An m×n matrix of a domain of category Cat::Matrix


The row index: a positive integer less or equal to m

r1 .. r2

A range of row indices (positive integers less or equal to m)


A list of row indices (positive integers less or equal to m)

Return Values

Matrix of a domain of category Cat::Matrix(R), where R is the component ring of A or NIL.

Was this topic helpful?