Accelerating the pace of engineering and science

Documentation Center

• Trial Software

removeconstantrows

Process matrices by removing rows with constant values

Syntax

[Y,PS] = removeconstantrows(X,max_range)
[Y,PS] = removeconstantrows(X,FP)
Y = removeconstantrows('apply',X,PS)
X = removeconstantrows('reverse',Y,PS)

Description

removeconstantrows processes matrices by removing rows with constant values.

[Y,PS] = removeconstantrows(X,max_range) takes X and an optional parameter,

 X Single N-by-Q matrix or a 1-by-TS row cell array of N-by-Q matrices max_range Maximum range of values for row to be removed (default is 0)

and returns

 Y Each M-by-Q matrix with N - M rows deleted (optional) PS Process settings that allow consistent processing of values

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

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

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

Examples

Here is how to format a matrix so that the rows with constant values are removed.

```x1 = [1 2 4; 1 1 1; 3 2 2; 0 0 0]
[y1,PS] = removeconstantrows(x1)
```

Next, apply the same processing settings to new values.

```x2 = [5 2 3; 1 1 1; 6 7 3; 0 0 0]
y2 = removeconstantrows('apply',x2,PS)
```

Reverse the processing of y1 to get x1 again.

```x1_again = removeconstantrows('reverse',y1,PS)
```