MEX: pointers to a matlab structure

Hello,
I have the following problem. There is a Matlab structure as follows:
d(1).x=uint32([1 4 6 7 ]);
d(1).y=single([3.3 2.5 3.5 4.4]);
d(2).x=uint32([6 1 7 ]);
d(2).y=single([2.5 3.8 4.4]);
....
d(n).x=uint32(...
d(n).y=single(...
The structure "d" is huge (40GB). I need to do some fast calculation with it. How can I get pointers e.g. d(2).x(3) and d(2).y(3) in MEX?
PETR

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2013년 8월 28일

1 개 추천

You need to use mxGetField to access structure fields and mxGetData to access data in a numeric array. If you'd like to see an example, I'd recommend $matlab/extern/examples/refbook/phonebook.c (where $matlab is the location of your MATLAB installation). There are other examples for the MEX API in the same directory.

카테고리

도움말 센터File Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

제품

질문:

2013년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by