Typedefs | Functions

Matlab.h File Reference

#include <stdio.h>
#include <string.h>
#include "Engine.h"
Include dependency graph for Matlab.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef size_t mwIndex

Functions

bool InitMatlabEngine ()
void CloseMatlabEngine ()
Engine * GetEngine ()
mxArray * _CreateDoubleMatrix (int nRow, int nCol, double *pData, char *szVarName)

Typedef Documentation

typedef size_t mwIndex

Definition at line 21 of file Matlab.h.


Function Documentation

mxArray* _CreateDoubleMatrix ( int  nRow,
int  nCol,
double *  pData,
char *  szVarName 
)

Definition at line 48 of file Matlab.cpp.

{
        if (!InitMatlabEngine())
                return NULL;
#ifndef NO_MATLAB
        Engine* ep = GetEngine();

        mxArray* pArr = mxCreateDoubleMatrix(nRow, nCol, mxREAL);
        double* xr = mxGetPr(pArr);
        memcpy(xr, pData, sizeof(double) * nRow * nCol);
        engPutVariable(ep, szVarName, pArr);
        return pArr;    
#else
        return NULL;
#endif
}

Here is the call graph for this function:

void CloseMatlabEngine (  ) 

Definition at line 30 of file Matlab.cpp.

{
#ifdef NO_MATLAB
        assert(false);          // build without Matlab supports!

        return;
#else
        if (gpMLEngine)
                engClose(gpMLEngine);
#endif
}

Engine* GetEngine (  ) 

Definition at line 42 of file Matlab.cpp.

{
        return (gpMLEngine);
}

Here is the caller graph for this function:

bool InitMatlabEngine (  ) 

Definition at line 9 of file Matlab.cpp.

{
#ifdef NO_MATLAB
        assert(false);          // build without Matlab supports!

        return (false);
#else
        if (gpMLEngine)
                return (true);  // no need

        gpMLEngine = engOpen(NULL);     
        if (gpMLEngine == NULL)
        {
                printf("Starting Engine Fails");
                return(false);
        }

        return (true);
#endif
}

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines