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
See Also: imat
ND=removeimat(D,r,c)
D: | indexed matrix | |
r: | row to delete | |
c: | column to delete |
ND: | Matrix without this column and row |
D=imat(rand(3,5)), removeimat(D,1,2)
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.
D.D.D.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.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.ND, is the matrix with the specified row and column removed.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.