Info

This question is closed. Reopen it to edit or answer.

Suggestions for running FORTRAN source code through MATLAB; mex finds too many errors

1 view (last 30 days)
Hi all,
I am interested in running a FORTRAN source code through MATLAB. I want to use either mex or f2matlab to do this, but in either case, I'm getting errors.
  • mex specifically states: "??? Error using ==> mex at 222; Unable to complete successfully."
Does this mean that need to make edits to the FORTRAN code line-by-line, or should I try a different compiler, or something else entirely?
  • f2matlab gives me the error:
"??? Attempted to access temp(0); index must be a positive integer or logical.
Error in ==> changeoperator_f at 69
temp=find(~isspace(funstr{i}));
temp=temp(temp<loc);
temp=temp(length(temp));"
, etc. I can't find where in particular this is an issue in the FORTRAN code. Am I using this function incorrectly?
I've read through just about all the mathworks questions on this sort of topic, but I just don't have enough experience with running FORTRAN files to know where to start fixing these errors. Anyone have any immediate suggestions for resources or where to go next? (Keeping in mind that I'm not terrible with MATLAB, but the C/FORTRAN side to this is pretty new to me.)
The FORTRAN code in question is a USDA soil model (SHAW) and is located in the zip file at the bottom of this page in the code file: http://www.ars.usda.gov/Research/docs.htm?docid=16931
  7 Comments
Jan
Jan on 14 Apr 2015
And this means, that it is not a problem of errors in the fortran code, but mex is missing the compiler.
canally
canally on 14 Apr 2015
Ah! Okay. This makes sense. I had assumed that the compilers listed at http://www.mathworks.com/support/compilers/R2010b/index.html were general, and would cover Fortran as well as C++. It looks like the Fortran compilers (Intel) are only available as expensive commercial packages. I think I'll have to find another workaround besides mex.
Thank you for your help!

Answers (0)

Community Treasure Hunt

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

Start Hunting!