This is machine translation

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


Process matrices by removing rows with specified indices


[Y,PS] = removerows(X,'ind',ind)
[Y,PS] = removerows(X,FP)
Y = removerows('apply',X,PS)
X = removerows('reverse',Y,PS)
dx_dy = removerows('dx',X,Y,PS)
dx_dy = removerows('dx',X,[],PS)
name = removerows('name')
fp = removerows('pdefaults')
names = removerows('pdesc')


removerows processes matrices by removing rows with the specified indices.

[Y,PS] = removerows(X,'ind',ind) takes X and an optional parameter,


N-by-Q matrix


Vector of row indices to remove (default is [])

and returns


M-by-Q matrix, where M == N-length(ind)


Process settings that allow consistent processing of values

[Y,PS] = removerows(X,FP) takes parameters as a struct: FP.ind.

Y = removerows('apply',X,PS) returns Y, given X and settings PS.

X = removerows('reverse',Y,PS) returns X, given Y and settings PS.

dx_dy = removerows('dx',X,Y,PS) returns the M-by-N-by-Q derivative of Y with respect to X.

dx_dy = removerows('dx',X,[],PS) returns the derivative, less efficiently.

name = removerows('name') returns the name of this process method.

fp = removerows('pdefaults') returns the default process parameter structure.

names = removerows('pdesc') returns the process parameter descriptions.

removerows('pcheck',FP) throws an error if any parameter is illegal.


Here is how to format a matrix so that rows 2 and 4 are removed:

x1 = [1 2 4; 1 1 1; 3 2 2; 0 0 0]
[y1,ps] = removerows(x1,'ind',[2 4])

Next, apply the same processing settings to new values.

x2 = [5 2 3; 1 1 1; 6 7 3; 0 0 0]
y2 = removerows('apply',x2,ps)

Reverse the processing of y1 to get x1 again.

x1_again = removerows('reverse',y1,ps)

More About

collapse all


In the reverse calculation, the unknown values of replaced rows are represented with NaN values.

Introduced in R2006a

Was this topic helpful?