I'm a little stuck if my current goal is possible, and if so, how to do it. I hope to interact with some C ++ classes through the Mex file, but I need instances of the objects that I refer to in order to be constant in all calls from different Mex functions. For example, suppose I do the following in a Mex initialization file:
void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
size_t nCats = (size_t) *mxGetPr(prhs[0]);
std::vector<Cat> cats;
for(size_t i = 0; i <nCats; i++){
cats[i] = Cat();
}
}
So, I initialized Cat objects from my external C ++ code. Now, later in the line, I need to update the information about my Cat objects, so in another Mex file I have
void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
for(size_t i = 0; i < nCats; i++){
cats[i].feed();
}
}
Here are my questions:
std::vector Mex? -Matlab Mex ( ), Mathworks , Mex , , . std::vector , , ? ?
Matlab? , Matlab ++, , Matlab . , ++ , Matlab, .