Getting the values of a Matlab Structure using a FORTRAN MEX file
Mostra commenti meno recenti
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 Commento
Jan
il 21 Mag 2015
"It does not seem to correctly get the values" is not a useful description. Please explain what happens. What is "input"?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Fortran with MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!