2.2.3.19.5 vectorbase::Data

Description

Fill vector with double type data


Fill vector with integer type data

With system variable @DET, you can decide to use specified value dEndVal or last calculated value as end value of range.

Syntax

BOOL Data( double dStartVal, double dEndVal, double dIncVal = 1.0 )


BOOL Data( int nStartVal, int nEndVal, int nIncVal = 1 )

Parameters

dStartVal
[input] value assigned to the first element of the vector
dEndVal
[input] value generated for the last element in the vector
dIncVal
[input] increment value used to calculate successive values in the vector


nStartVal
[input] value assigned to the first element in the vector
nEndVal
[input] value generated for the last element in the vector
nIncVal
[input] increment value used to calculate successive values in the vector

Return

Returns TRUE on success, FALSE on failure to generate data.


Returns TRUE on success, FALSE on failure to generate data.

Examples

EX1

void vectorbase_Data_Ex1()
{
    vector<double> vec;

    if( FALSE == vec.Data(0.0, 1.0, 0.3) )
    {
    	out_str("Error filling vector with data.");
    	return;
    }

    for( int i = 0; i < vec.GetSize(); i++ )
    	printf("%2d == %f\n", i, vec[i]);
}


EX2

void vectorbase_Data_Ex2()
{
    vector<int> vec;

    if( FALSE == vec.Data(1, 10, 2) )
    {
    	out_str("Error filling vector with data.");
    	return;
    }

    for( int i = 0; i < vec.GetSize(); i++ )
    	printf("%2d == %d\n", i, vec[i]);
}

Remark

Fill vector with double/integer type data generated using specified min, max and increment value. The vector will be automatically resized and populated with data values such that the first element in the vector will be dStartVal/nStartVal and the last element in the vector will be greater than or equal to dEndVal/nEndVal. If dIncVal/nIncVal is passed in as zero the function will fail.

See Also

Header to Include

origin.h