2.1.6.26 okutil_convert_double_vector_to_string_vector


Description

Convert double array to string array with formatting

Syntax

int okutil_convert_double_vector_to_string_vector( DoubleArray * pdaDoubles, StringArray * psaStrings, UINT nSize, StringArray * psaFormats = NULL )

Parameters

pdaDoubles
[input]source double array to convert
psaStrings
[output]string array for the result
nSize
[input]value to set psaStrings's size
psaFormats
[input] LabTalk formatting string array for each cell in pdaDoubles

Return

Number of converted items

Examples

EX1

 void okutil_convert_double_vector_to_string_vector_ex1()
{
    vector<string> strVec;
    vector<double> dVec = {1.113,0.786,3,-2.097,10.894,2.168,0,8.123};
    vector<string> fVec = {"*1","*2","*3","*4","*5","*6","*7","*8"};
    int nRet = okutil_convert_double_vector_to_string_vector(&dVec , &strVec ,8,&fVec );
    if(nRet)
    {
        printf("%d items converted :\n" , nRet);//Output: 8 items converted : 1   0.79   3.00   -2.097   10.894   2.16800   0.000000   8.1230000 
        for(int ii = 0; ii < strVec.GetSize() ; ii++)
            printf("%s   " , strVec[ii]);
        printf("\n");
    }
    else 
        printf("Convert failed");
}

Remark

See Also

convert_double_vector_to_string_vector,

Header to Include

origin.h

Reference