Accelerating the pace of engineering and science

# Documentation Center

• Trials
• Product Updates

# nanmax

Maximum ignoring NaNs

## Syntax

```m = nanmax(X)
[m,ndx] = nanmax(X)
m = nanmax(X,Y)
[m,ndx] = nanmax(X,[],DIM)
```

## Arguments

 X Financial times series object. Y Financial times series object or scalar. DIM Dimension of X.

## Description

nanmax for financial times series objects is based on the Statistics Toolbox™ function nanmax. See nanmax in the Statistics Toolbox documentation.

m = nanmax(X) returns the maximum of a financial time series object X with NaNs treated as missing. m is the largest non-NaN element in X.

[m,ndx] = nanmax(X) returns the indices of the maximum values in X. If the values along the first nonsingleton dimension contain multiple maximal elements, the index of the first one is returned.

m = nanmax(X,Y) returns an array the same size as X and Y with the largest elements taken from X or Y. Only Y can be a scalar double.

[m,ndx] = nanmax(X,[],DIM) operates along the dimension DIM.

## Examples

To compute nanmax for the following dates:

```dates = {'01-Jan-2007';'02-Jan-2007';'03-Jan-2007'};
f = fints(dates, magic(3));
f.series1(1) = nan;
f.series2(3) = nan;
f.series3(2) = nan;

[nmax, maxidx] = nanmax(f)```
```nmax =
4     5     6

maxidx =
3     2     1```

## See Also

Was this topic helpful?