Info

此问题已关闭。 请重新打开它进行编辑或回答。

Passing different data type between various mex functions from within matlab

1 次查看(过去 30 天)
Suppose I want to pass a pointer to different data type to pass between various functions in Matlab, can I do it?
For e.g: Suppose the library in C I use two structure pointers "ghkModel* m" and "ghkData* d". These are library specific data types. These are two large structures that contains various fields. I need to preserve the content of ghkData *d since it is used later by varous functions.
Is there a way to do this:
For example, this is what I want to do:
myMatlabFunction()
[m, d] = C_mex_funtion_1(); % m and d contains the structure ghkModel and ghkData
[p, q] = C_mex_function_2(m,d);
rslt = C_mex_function_3(p,q, m,d);
end
Basically question is how to pass in data that is not of type mxArray to other mex functions within matlab code?
And how to allocate memory to it? I mean in the mex entry point.
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
ghkModel* m = mxGetPr(prhs[0]);
ghkData* d = mxGetPr(prhs[1]);
callSomeFunction(m,d);
}
Any helpful suggestion is appreciated.

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by