11 #ifndef EASYLINK_MATLABARRAY_H 12 #define EASYLINK_MATLABARRAY_H 25 const mxArray *mxarray;
27 mxarray=mexGetVariablePtr(workspace.c_str(),name.c_str());
29 throw runtime_error(
"easyLink error: Unable to find a double array named "+name+
".");
31 return Array(mxarray,name,
true);
42 const mxArray *mxarray;
44 mxarray=mexGetVariablePtr(workspace.c_str(),name.c_str());
46 return (mxarray!=NULL);
59 mxarray=mxCreateDoubleMatrix(nrows,ncols, mxREAL);
61 throw runtime_error(
"easyLink error: Unable to create a double array named "+name+
".");
63 if (mexPutVariable(workspace.c_str(),name.c_str(),mxarray))
64 throw runtime_error(
"easyLink error: Unable to put variable "+name+
" in workspace "+workspace+
".");
66 mxDestroyArray((mxArray*)mxarray);
Array newMatlabArray(int nrows, int ncols, string name, string workspace="base")
Array getMatlabArray(string name, string workspace="base")
bool existMatlabArray(string name, string workspace="base")