Matlab::GetMatrix

Description

Transfer Matlab matrix to Origin Matrix. OriginC matrix not currently supported.

Syntax

BOOL GetMatrix( LPCSTR lpcszMatrixName, Matrix * pmmReal, Matrix * pmmImag = NULL, LPCSTR lpcszMatLabWorkspace = NULL )

Parameters

lpcszMatrixName
The name of the Matlab matrix source
pmmReal
Origin matrix as destination for the data
pmmImag
To receive complex matrix from Matlab, define Origin matrices for real and imaginary parts. Currently not implemented -
leave without this optional argument, or set NULL to access the fourth parameter
lpcszMatLabWorkspace
default value "base" defines lpcszMatrixName in default Matlab workspace. The use of "global" for global Matlab workspace is not currently supported

Return

Returns TRUE on successful exit and FALSE on error.

Examples

EX1

// Assumes Current window is Matrix in Origin
#include <ExternApps.h>

void Matlab_GetMatrix_ex1()
{
        Matlab matObj(true);
        if(!matObj)
        {
                out_str("No Matlab found !!!!!");
                return;
        }
        string strRet1 = matObj.Execute("ma=[1 2 3; 4 5 6]");    //defines 2x3 matrix named ma
        MatrixLayer matLayer=Project.ActiveLayer();
        if (matLayer.IsValid())
        {
            Matrix mReal(matLayer);            
            BOOL bRet = matObj.GetMatrix("ma", &mReal);                //Transfer mat Matlab's matrix to mReal.
        }     
}

Remark

See Also

Matlab::PutMatrix

header to Include

ExternApps.h