Passing containers.Map to MEX file

How do you pass a containers.Map object to a MEX file? How do you access the data from inside the MEX file?

 채택된 답변

Titus Edelhofer
Titus Edelhofer 2011년 5월 13일

2 개 추천

Hi,
passing the variable is easy: just use it ;-). O.K., serious now. Passing is not the problem but doing anything meaningful will be. You will be able to call methods using mexCallMATLAB, e.g.,
/* cmap.c */
void mexFunction(int nlhs, mxArray* plhs[],
int nrhs, const mxArray* prhs[]) {
mexCallMATLAB(1, plhs, 2, prhs, "isKey");
}
and in MATLAB:
x = containers.Map('foo', 42);
v = cmap(x, 'foo');
Otherwise: pass x.keys and x.values to mex function and work with the two cell arrays ...
Titus

댓글 수: 1

Alex
Alex 2011년 5월 13일
Hey thank you so much for the quick response!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

제품

질문:

2011년 5월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by