#include <stdio.h>
#include <string.h>
#include "Engine.h"
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) |
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 }
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); }
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 }