# cummax {#cummax}

## Syntax {#syntax}

`cummax(X)`

Please see [Cumulative Window Functions](../Themes/cumFunctions.md) for the parameter description and windowing logic.

## Details {#details}

Cumulatively calculate the maximum values in *X*. It can be used to calculate maximum drawdown, for example.

## Examples {#examples}

```
x = [7,4,5,8,9]
cummax(x);
// output: [7,7,7,8,9]

m = matrix(6 5 7 8 1, 3 9 4 2 10);
m;
```

|\#0|\#1|
|---|---|
|6|3|
|5|9|
|7|4|
|8|2|
|1|10|

```
cummax(m);
```

|\#0|\#1|
|---|---|
|6|3|
|6|9|
|7|9|
|8|9|
|8|10|

Related functions: [cummin](cummin.md), [cumsum](cumsum.md), [cumprod](cumprod.md)

