Home

Awesome

DOCUMENTATION : matlab2fortran

<a href="https://www.buymeacoffee.com/hTpOQGl" rel="nofollow"><img alt="Donate just a small amount, buy me a coffee!" src="https://warehouse-camo.cmh1.psfhosted.org/1c939ba1227996b87bb03cf029c14821eab9ad91/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d4275792532306d6525323061253230636f666665652d79656c6c6f77677265656e2e737667"></a>

Brief description:

DESCRIPTION

matlab2fortran(matlab-to-fortran) is a code that performs an automatic conversion of one or multiple matlab files to fortran format. The script translate some of the main features of matlab to fortran. matlab2fortran performs a quick and dirty conversion on a line-by-line basis (but still supports conditional loops, subroutine). The script allows multiple matlab command per line if these commands are separated by ";", but not by ",".

matlab2fortran does not intend to produce ready-to-compile code, but performs several necessary conversions. The generated code keeps the structure, variables names and comments of the original code.

INSTALLATION AND REQUIREMENTS

The script is located in the release directory of the repository. The script matlab2fortran (matlab-to-fortran) is a single script file written in matlab. It does not require a particular installation other than maybe adding this script to your current folder or matlab path.

The script has been tested on linux and windows. The script has been tested on matlab and octave. (Octave generates some warnings. Ouputs are the same expect for some replacement of "...")

REVISIONS

FEATURES AND TODOs

Main Features of matlab2fortran:

TODOs:

Requests:

Features that are not intented to be supported

RUN INSTRUCTIONS and PARAMETERS

The script should run in few seconds for a file a 1000 lines (say 2s). If it takes longer, activate the Debug flag bDebug=1; to see where the script is stuck... Several parameters are found at the beginning of the script.

EXAMPLES

example 1: one file matlab2fortran('tests/test1.m');

example 2: list of files matlab2fortran('tests/test1.m','tests/test2.m');

example 3: all files in current directory (does not work with subfolders with dir..) FileList=dir('*.m'); matlab2fortran(FileList.name);

Contributing

Any contributions to this project are welcome! If you find this project useful, you can also buy me a coffee (donate a small amount) with the link below:

<a href="https://www.buymeacoffee.com/hTpOQGl" rel="nofollow"><img alt="Donate just a small amount, buy me a coffee!" src="https://warehouse-camo.cmh1.psfhosted.org/1c939ba1227996b87bb03cf029c14821eab9ad91/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d4275792532306d6525323061253230636f666665652d79656c6c6f77677265656e2e737667"></a>