Utilizing Gfortran with Matlab File Output
Show older comments
Hello, I am working to have some Fortran code output data into a .mat format so that we can work on the data in matlab faster than having to write ascii files in Fortran and read them in Matlab.
Matlab seems to be providing a method to do this, however, I am having trouble getting the sample file to run: http://www.mathworks.com/help/matlab/matlab_external/creating-a-mat-file-in-fortran.html I feel the issue has to be in the compiler flags or libraries I need to include, but I am not
I have tried the following command line fortran calls, however those both ran into issues:
gfortran -o matout matlabExample.F
gfortran -cpp -o matout matlabExample.F
gfortran -cpp -o matout matlabExample.F -I/opt/local/matlab/r2017a/bin/glnxa64/mexopts/
They lead to the following error:
/tmp/ccfoBdMw.o: In function `MAIN__':
matlabExample.F:(.text+0x85): undefined reference to `matopen_'
matlabExample.F:(.text+0x17b): undefined reference to `mxcreatedoublematrix730_'
matlabExample.F:(.text+0x18f): undefined reference to `mxgetpr_'
matlabExample.F:(.text+0x1ad): undefined reference to `mxcopyreal8toptr730_'
matlabExample.F:(.text+0x1c6): undefined reference to `mxcreatedoublematrix730_'
matlabExample.F:(.text+0x1dd): undefined reference to `mxcreatestring_'
matlabExample.F:(.text+0x1f4): undefined reference to `mxcreatestring_'
matlabExample.F:(.text+0x216): undefined reference to `matputvariableasglobal_'
matlabExample.F:(.text+0x2ad): undefined reference to `matputvariable_'
matlabExample.F:(.text+0x344): undefined reference to `matputvariable_'
matlabExample.F:(.text+0x3db): undefined reference to `matputvariable_'
matlabExample.F:(.text+0x464): undefined reference to `mxgetpr_'
matlabExample.F:(.text+0x482): undefined reference to `mxcopyreal8toptr730_'
matlabExample.F:(.text+0x4a1): undefined reference to `matputvariable_'
matlabExample.F:(.text+0x534): undefined reference to `matdeletevariable_'
matlabExample.F:(.text+0x5bd): undefined reference to `matclose_'
matlabExample.F:(.text+0x653): undefined reference to `matopen_'
matlabExample.F:(.text+0x6e7): undefined reference to `matgetvariable_'
matlabExample.F:(.text+0x6fb): undefined reference to `mxisfromglobalws_'
matlabExample.F:(.text+0x789): undefined reference to `matgetvariable_'
matlabExample.F:(.text+0x79d): undefined reference to `mxisnumeric_'
matlabExample.F:(.text+0x82b): undefined reference to `matgetvariable_'
matlabExample.F:(.text+0x83f): undefined reference to `mxischar_'
matlabExample.F:(.text+0x8cd): undefined reference to `matgetvariable_'
matlabExample.F:(.text+0x957): undefined reference to `mxdestroyarray_'
matlabExample.F:(.text+0x968): undefined reference to `mxdestroyarray_'
matlabExample.F:(.text+0x979): undefined reference to `mxdestroyarray_'
matlabExample.F:(.text+0x98a): undefined reference to `mxdestroyarray_'
matlabExample.F:(.text+0x99b): undefined reference to `matclose_'
collect2: error: ld returned 1 exit status
Computer: Linux (Ubuntu)
Fortran Compiler: gfortran (Version: 5.4.0 20160609)
Matlab Version: R2017a
Any insight on the issue would help me significantly. Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!