ocmath_replace_data_in_vector

 

Description

Replace elements that match the condition in a vector

Syntax

int ocmath_replace_data_in_vector( UINT lSize, double * pv, const double dThreshold, const double dRepVal, UINT wBitwiseOption = MATREPL_TEST_EQUAL )

Parameters

lSize
[input] the size of the vector
pv
[modify] pointer to the vector
dThreshold
[input] the threshold value to be compared to
dRepVal
[input] the value to replace the elements matching the condition
wBitwiseOption
[input] the comparison condition

Return

Return OE_NOERROR if succeed, otherwise, non-zero error code is returned.

Examples

EX1

void ocmath_replace_data_in_vector_ex1()
{
    vector vx = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    ocmath_replace_data_in_vector(vx.GetSize(), vx, 5, 0, MATREPL_TEST_EQUAL | MATREPL_TEST_GREATER);
    // vx = {1, 2, 3, 4, 0, 0, 0, 0, 0, 0} now
}

Remark

See Also

header to Include

origin.h

Reference