Getting the values of a Matlab Structure using a FORTRAN MEX file
이전 댓글 표시
Hi, I am trying to pass a matlab structure to a FORTRAN subroutine. In my gateway routine, I am trying to get the values of the matlab structure and store it in a fortran array. using this code
mwpointer x_ptr(72)
mwIndex index
index =1
do 40 i=1,72
x_ptr(i)=mxGetFieldByNumber(prhs(1),index,i)
call mxCopyPtrToReal4(x_ptr, input(i), nelem)
40 continue
Ps: the structure has 72 fields. however, it does not seem to correctly get the values from the matlab structure and place it in the fortran array. Can someone please help?
댓글 수: 1
Jan
2015년 5월 21일
"It does not seem to correctly get the values" is not a useful description. Please explain what happens. What is "input"?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!