Matlab::PutMatrix

Description

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

Syntax

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

Parameters

lpcszMatrixName
The name of the Matlab matrix to receive the data
pmmReal
Origin matrix is the source of the data
pmmImag
To create complex matrix in Matlab, define Origin matrices for real and imaginary parts
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

#include <ExternApps.h>
// Current window is matrix and with sample data exists in Origin
void Matlab_PutMatrix_ex1()
{
    Matlab matObj(TRUE);
    if(!matObj)
    {
        out_str("No Matlab found");
        return;
    }
// Matlab object successfully created, i.e. communication established
    MatrixLayer matLayer=Project.ActiveLayer();
    if (matLayer.IsValid())
    {
        Matrix mReal(matLayer);
        BOOL bRet = matObj.PutMatrix("mat", &mReal);   //Transfer mReal data to mat Matlab's matrix. mat will be created if it didn't exist before
        if (bRet) 
        {
            string strRet = matObj.Execute("mat");           //strRet will contain display of mat
            out_str(strRet);
        }
     }
}

Remark

See Also

Matlab::GetMatrix

header to Include

ExternApps.h