Documentation

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.

linalg::delCol

Delete matrix columns

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.

Syntax

linalg::delCol(A, c)
linalg::delCol(A, c1 .. c2)
linalg::delCol(A, list)

Description

linalg::delCol(A, c) returns a copy of the matrix A in which the column with index c is deleted.

linalg::delCol(A, c1.. c2) deletes those columns whose indices are in the range c1.. c2. If c2< c1 then the input matrix A is returned.

linalg::delCol(A, list) deletes those columns whose indices are contained in list.

If all columns are deleted then NIL is returned.

Examples

Example 1

We define the following matrix:

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

and demonstrate the three different input formats for linalg::delCol:

linalg::delCol(A, 2)

linalg::delCol(A, [1, 3])

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

Example 2

We compute the inverse of the 2×2 matrix:

MatQ := Dom::Matrix(Dom::Rational): 
A := MatQ([[3, 2], [5, -4]])

by appending the 2×2 identity matrix to the right side of A and applying the Gauss-Jordan algorithm provided by the function linalg::gaussJordan:

B := linalg::gaussJordan(A . MatQ::identity(2))

We get the inverse of A by deleting the first two columns of the matrix B:

AI := linalg::delCol(B, 1..2)

Finally, we check the result:

A * AI, AI * A

Note: The inverse of A can be computed directly by entering 1/A.

Parameters

A

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

c

The column index: a positive integer less or equal to n

c1 .. c2

A range of column indices (positive integers less or equal to n)

list

A list of column indices (positive integers less or equal to n)

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?