benbarrowes/f2matla​b

Converts basic fortran90 source code to MATLAB source code.
23.8K Downloads
Updated 5 Mar 2021

CONTENTS:
-1. SUPPORT f2matlab AND CONSULTING
0. DISCLAIMER
1. OBJECTIVE
2. MOTIVATION
3. BUG REPORTS and WISH LIST
4. F2MATLAB CAPABILITIES
5. F2MATLAB LIMITATIONS
6. HOW TO USE F2MATLAB
7. EXAMPLES
8. REVISION HISTORY
-1.SUPPORT f2matlab.
I now also do conversion/translation/validation/optimization consulting.
Please refer to my webpage:
https://sites.dartmouth.edu/barrowes/consulting/

Even though f2matlab is free (under GPL) for the using, I would like
to ask that those who find it useful, wish to support the project,
and are able to make a contribution to please do so commesurate with
use (especially corporations). *** Important - Please donate using
your PayPal account and not a credit card so as to avoid fees at
PayPal. Thank you! PayPal email ID: barrowes@alum.mit.edu

0. DISCLAIMER: Matlab is a trademark of the Mathworks company and is
owned by them. The author makes no guarantee express or implied of
any kind as to the applicability, usefulness, efficacy,
bug-freeness, or the accuracy of the ensuing results from using
f2matlab.

The author bears no responsibility for any unwanted effect
resulting from the use of this program. The author is not
affiliated with the Mathworks. The source code is given in full in
the hopes that it will prove useful.

1. OBJECTIVE: f2matlab.m is a small translator which aims to
convert Fortran90 files to Matlab m-files.

2. MOTIVATION:

1) Matlab is becoming ubiquitous in the engineering and scientific
communities for its ease of use coupled with its powerful
libraries. Yet the fact remains that a large number of stable and
dependable programs exist in the fortran77/90 corpus.

2) Many times, often amidst the porting of fortran programs to
Matlab, an automated converter of fortran90 code to Matlab code would
be useful.

3) Having written matlab2fmex.m, a matlab to fortran90 mex file
converter, the writing of f2matlab, which performs the reverse
conversion, was substantially simplified.

3. BUG REPORTS and WISH LIST:
For all bug reports, a wish list for f2matlab, and suggestions,
see https://sites.dartmouth.edu/barrowes/consulting/
or email barrowes@alum.mit.edu

4. F2MATLAB CAPABILITIES: f2matlab is aimed at converting
Fortran90 code to Matlab m-files. Accordingly, only basic data types
and constructions are recommended. f2matlab can handle:

all numeric types (handled by Matlab interpreter)
most string functions
comparisons, branches, loops, etc.
basic read/write/print statements (if it's not too fancy...)
modules

5. F2MATLAB LIMITATIONS: f2matlab can not handle some features of
fortran90 yet. These include:

can't handle complex read and write statements
derived-typed variables
equivalence
...

6. HOW TO USE F2MATLAB: f2matlab expects a single fortran90 fortran file to
convert. If you have fortran77 code, use some free converter
(e.g. to_f90 by Alan Miller) before running f2matlab. Then simply
call f2matlab by using the full filename:
f2matlab('filename.f90');
The output will be filename.m in the same directory.

A few flags are available that effect conversion:
% want_kb=0; 1 ==> if keyboard mode is desired after some conversion steps
% want_ze=0; 1 ==> direct f2matlab to zero all array variables.
% want_fi=0; 1 ==> direct f2matlab to try to put fix()'s around declared integers.

Multiple subroutines and functions can and should be in the same fortran90 file.

Cite As

Ben Barrowes (2024). benbarrowes/f2matlab (https://github.com/benbarrowes/f2matlab), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Fortran with MATLAB in Help Center and MATLAB Answers
Acknowledgements

Inspired: Generalised Exponential Integral, GaussHermite

Community Treasure Hunt

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

Start Hunting!

Versions that use the GitHub default branch cannot be downloaded

Version Published Release Notes
4.1.0.1

Changed description to match new Dartmouth website

4.1.0.0

Updated description.
Now on github.

1.6.0.0

Added link to most recent version off site.

1.3.0.0

Several bug fixes and enhancements. Include files, types, etc.

1.2.0.0

bug fixes, features added, more robust

1.1.0.0

Some documentation updates and bug fixes.

1.0.0.0

Many bug fixes and major upgrade of capabilities.

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.