how to mex free fortran 90 format with the last matlab release

10 Ansichten (letzte 30 Tage)
Alain Barraud
Alain Barraud am 1 Okt. 2023
Kommentiert: dpb am 5 Okt. 2023
Hi every on.
It seems that by default fixed format is expected even with the file extension f90 or F90.
How to change the setting /fixed which is probably within a config file. There is no more mexopts.bat file!?
I am running R2023a release using the last intel fortran compiler. No problem with fortran 77 files and their mex gateway.
I have probably missed something but it is very strange that fortran 90 95 ... were not recognized by default.
Within mathworks doc I have not found any exemple with a such fortran code (only the same f77 code like timestwo yprime since several tens of years)
Best regards
Alain

Akzeptierte Antwort

dpb
dpb am 1 Okt. 2023
Bearbeitet: dpb am 1 Okt. 2023
" ... but it is very strange that fortran 90 95 ... were not recognized by default."
Oh, indeed! Add your complaint to official Mathworks support about the abominable Fortran support that is some 40+ years out of date!!! :(
To fix that problem, find the .xml file for the particular compiler release you have installed. They will be under the root MATLAB install directory under /bin/win64/mexopts.
Then remove the stupid "/fixed" switch.
There will be a line like the following in the file...that's where the problem lies -- why Mathworks can't get into at least this century is beyond ken.
COMPFLAGS="/nologo /fpp /Qprec /fixed /MD /fp:source /assume:bscc $INCLUDE $COMPDEFINES"
There's also an issue with default naming -- be sure to use the lowercase 'f' in the file names so the fortran preprocessor will run to expand the macros TMW uses for type definitions (which also still are the nonStandard and archaic REAL*N form)
  10 Kommentare
Alain Barraud
Alain Barraud am 5 Okt. 2023
In my mexopt folder i have a list of xml file corresponding to the set of intel fortran compilers supported by the current matlab release. I have renamed the original file corresponding to the installed intel version and suppressed the /fixed within a xml file with the original name. Once done when mex -setup Fortran is executed I see two fortran compilers one which is restricted to the fixed format the other compatible with f90 free format. Now I can select the compiler I want to use. My conclusion is that if you install several compatible intel Fortran compiler versions you can choose among them and adding new modified xml files incresses the possible choices.
Best regards
Alain
dpb
dpb am 5 Okt. 2023
Agreed, that's how the -setup option works with the xml files -- my problem is I have a newer version of the Intel compiler than that which the present version of MATLAB supports and I haven't been able to manage to create a new one that works to find that version...and I don't want to switch horses in midstream of some other work on upgrading MATLAB just now and so far I've not been able to figure out how to get to the earlier Intel compiler download.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Fortran with MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by