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.

removerows

Process matrices by removing rows with specified indices

Syntax

[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('pcheck',FP)

Description

removerows processes matrices by removing rows with the specified indices.

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

X

N-by-Q matrix

ind

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

and returns

Y

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

PS

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.

Examples

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)

Algorithms

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

Introduced in R2006a

Was this topic helpful?