Getting index of multidimensional array passed to mex function

Hi,
I have an 4D array of size 31*229*374*80 (id, y, x, z) which I pass as input to a mex function. This is read as a 1D array in the mex function and is repoted as being a 229* 11594*80 (11594 = 31*374). I am confused about how to get the value of a given index in the function now. Suppose I want to get the value of array number 10 and inexes 50, 100, 40 in the 1D array in the mex function. How do I get to the correct address in the array ?
Thanks in advance,
Kamran

댓글 수: 2

James Tursa
James Tursa 2020년 6월 19일
편집: James Tursa 2020년 6월 19일
Please give more details and show your code. All variables retain their sizes (dimensions) when passed into a mex routine. If you are seeing a different size then you are not coding properly, or the variable is not the size you think it is.
Sorry, my stupid mistake. I was already reshaping the matrix before sending it to mex function.
Thanks.

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

답변 (0개)

카테고리

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

질문:

2020년 6월 19일

댓글:

2020년 6월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by