Linking Fortran to Matlab-generated MEX files
이전 댓글 표시
Hey!
I have written a trajectory code in Matlab and sped it up by compiling it into C using the codegen command. I run this code from matlab as a Trajectory_Mex function and got a 100x speed up compared to the original Matlab script, which is great given that even with the speed up my calculations take a few hours on a cluster.
The trajectory calculations need potential functions, which were provided to me in a Fortran format. After going through Matlab documentation I learned that I could also make Fortran-mex files, that work from the main Matlab workspace but when I try to compile a Matlab script that uses the Fortran-mex file I get the " ??? Only MATLAB files are supported for code generation. Unsupported file extension 'mexa64' for '/PotentialTests/O3PES/timestwo.mexa64'" error.
Is it possible to use a Fortran-mex within a codegen-compiled script? Do I have to rewrite the Fortran files to use codegen? What is the best way for me to implement my Fortran code within compiled scripts?
Thank you very much! MK.
채택된 답변
추가 답변 (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!