Find true values indexes in a boolean vector.

Namespace: dsp

Prototype

vector<int> find(const Vecb &x)

Parameters

xBoolean vector

Returns

Vector containing the indexes for which the input vector elements are true.

Description

Example

let x = linspace(-2, 2, 5); // -2, -1, 0, 1, 2
let idx = find(x >= 0); // idx = {2, 3, 4}

See also

find_first(), find_last()