2.1.26.7 get_numerica_matrix_treenode


Description

Get matrix data from the current tree node

Syntax

bool get_numerica_matrix_treenode( TreeNode & tr, matrixbase & matNum )

Parameters

tr
[input]the source tree node
matNum
[output]the output matrix

Return

Returns true for success or false not.

Examples

EX1

void get_numerica_matrix_treenode_Ex1()
{
    Tree tr;
    TreeNode trN = tr.AddNode("node1",1);
    matrix<int> matd = {
        {1, 2, 3},
        {4, 5, 6}
    };
    trN.nVals2 = matd; // assign int type matrix
 
    matrix<double> matCheck;
    if(get_numerica_matrix_treenode(trN,matCheck)) // get matrix as double data type
    {
        for(int ii = 0; ii < matCheck.GetNumRows(); ii++)
        {               
            for(int jj = 0; jj < matCheck.GetNumCols(); jj++)
                printf("%f\t",matCheck[ii][jj]);    
            printf("\n");
        }
    }
    else
        printf("fail to obtain data from treenode\n");
}

Remark

See Also

get_numerica_vector_treenode

Header to Include

origin.h

Reference