removeimat

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 3.9, Creation date: 2017-06-05, Last change: 2025-09-14

removes a row and a column of a indexed matrix



See Also: imat

Example Illustration

 missing image of removeimat(D,r,c)

Syntax

ND=removeimat(D,r,c)

Input Parameter

D: indexed matrix
r: row to delete
c: column to delete

Output Parameter

ND: Matrix without this column and row

Examples


D=imat(rand(3,5)), removeimat(D,1,2)




Copyright 2017-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, removeimat, is designed to remove a specified row and column from an indexed matrix. Below is a detailed explanation of the algorithm and its parameters.

Input Parameters

Output

Algorithm Steps

  1. The function first removes the specified row r from the matrix D. This is done by concatenating two submatrices: one containing all rows from the start up to the row before r, and the other containing all rows from the row after r to the end of the matrix. The syntax D(1:r,:) selects all rows from the first to the r-th row, and D(r+2:end,:) selects all rows from the r+2-th row to the last row.
  2. Next, the function removes the specified column c from the intermediate matrix obtained after the row removal. This is achieved by concatenating two submatrices: one containing all columns from the start up to the column before c, and the other containing all columns from the column after c to the end of the matrix. The syntax ND(:,1:c) selects all columns from the first to the c-th column, and ND(:,c+2:end) selects all columns from the c+2-th column to the last column.
  3. The final result, ND, is the matrix with the specified row and column removed.

Example

Consider a matrix D generated by imat(rand(3,5)). If we call removeimat(D,1,2), the function will remove the first row and the second column from D, resulting in a new matrix ND.

Algorithm explaination created using ChatGPT on 2025-08-18 21:53. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21