MATLAB Examples

This function returns the elements in a 2D matrix bounded by the quandrangle encompassing all real values in the input matrix.

## Syntax

```tf = inrealquad(A)

## Description

tf = inrealquad(A) returns a logical matrix tf the size of 2D matrix A. tf is true for all elements in A bounded by the quandrangle containing all real values in A.

[rows,cols] = inrealquad(A) returns the rows and columns of A containing all real values in A.

Atrim = inrealquad(A,'trim') trims A to the quadrangle containing all finite values in A.

## Example

Here is some sample data A with two rows and one column of NaNs. Also a few extra NaNs in the middle to make it clear how this function works:

```A = rand(8,5); A(:,1) = NaN; A([1 2 7],:) = NaN; A(5,3) = NaN; A(3:4,5) = NaN; ```

The sample matrix A looks like this:

```A ```
```A = NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 0.0855 0.2373 0.6791 NaN NaN 0.2625 0.4588 0.3955 NaN NaN 0.8010 NaN 0.3674 0.3354 NaN 0.0292 0.5468 0.9880 0.6797 NaN NaN NaN NaN NaN NaN 0.7303 0.2316 0.8852 0.7212 ```

Get a logical matrix the size of A which shows the quadrangle of finite values in A:

```tf = inrealquad(A) ```
```tf = 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 ```

Alternatively, you can get rows and columns corresponding to the quadrangle in A containing all real data in A:

```[rows,cols] = inrealquad(A) ```
```rows = 0 0 1 1 1 1 1 1 cols = 0 1 1 1 1 ```

Or you can trim A to the quadrangle that contains all real values in A:

```Atrimmed = inrealquad(A,'trim') ```
```Atrimmed = 0.0855 0.2373 0.6791 NaN 0.2625 0.4588 0.3955 NaN 0.8010 NaN 0.3674 0.3354 0.0292 0.5468 0.9880 0.6797 NaN NaN NaN NaN 0.7303 0.2316 0.8852 0.7212 ```

## Author Info

This function was written by Chad A. Greene of the University of Texas at Austin's Institute for Geophysics (UTIG), September 2015.