VALFILL

Purpose:

Replaces a value with previous or next value.

Syntax:

VALFILL(series, val, mode)

series

-

An input series or array.

val

-

Optional. A real, the value to replace. Defaults to 0.0.

mode

-

Optional. An integer, the fill mode:

 

 

-1:

No fill, retain existing values (hardware based).

 0:

No fill, retain existing values (software based).

 1:

Fill forward using the previous known value.

 2:

Fill forward, then backward (default).

 3:

Fill backward using the next known value.

 4:

Fill backward, then forward.

Returns:

A series or array.

Example:

W1: {1, 0, 0, 3, 4, 0, 5}

W2: valfill(W1, 0, 1)

W3: valfill(W1, 0, 3)

 

W2 == {1, 1, 1, 3, 4, 4, 5}

W3 == {1, 3, 3, 3, 4, 5, 5}

 

The zeros of W2 are replaced with the last non-zero value.

The zeros of W3 are replaced with the next non-zero value.

Example:

W1: randn(10)

W2: (W1 > 0.4) * W1

W3: valfill(W2)

 

W3 contains an array where the zeros of each column of W2 are replaced with the last non-zero value or if no value is found, the next non-zero value.

Remarks:

VALFILL is based on NAFILL. See NAFILL for more details.

See Also:

NAFILL

REMOVE

REPLACE