Getting the values of a Matlab Structure using a FORTRAN MEX file
Show older comments
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 Comment
Jan
on 21 May 2015
"It does not seem to correctly get the values" is not a useful description. Please explain what happens. What is "input"?
Accepted Answer
More Answers (0)
Categories
Find more on Fortran with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!