Thread Subject: File conversion: fortran to matlab

Subject: File conversion: fortran to matlab

From: Sneha

Date: 24 Jun, 2008 23:54:05

Message: 1 of 4

Hello

I have gone through google search, other forums and similar
message posted here also. I have not got really a way to
convert f90 file to matlab file. Its really a big file.
Can anyone please help me?

Thanks.

Subject: File conversion: fortran to matlab

From: Matt Fig

Date: 25 Jun, 2008 01:19:05

Message: 2 of 4

I just did it today, on a 300 line file, by hand. If you
know Matlab, Fortran isn't that much different I don't
think. Just copy and paste, do some rearranging and
relabeling, and you're done. Really, I have no Fortran
training at all and I figured it out in less than an hour.

I did have to use the online Fortran reference at IBM a
couple of times to find out the syntax of the IF statements,
DO loops, etc. It still wasn't that bad.

Subject: File conversion: fortran to matlab

From: Steven Lord

Date: 25 Jun, 2008 03:18:50

Message: 3 of 4


"Sneha " <smithpamola@yahoo.com> wrote in message
news:g3s1et$g8e$1@fred.mathworks.com...
> Hello
>
> I have gone through google search, other forums and similar
> message posted here also. I have not got really a way to
> convert f90 file to matlab file. Its really a big file.
> Can anyone please help me?

As an alternative to converting over the file, you may be able to write a
wrapper to make this into a MEX-file:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/bp_kqh7.html

The third and fifth items could be useful for you.

--
Steve Lord
slord@mathworks.com

Subject: File conversion: fortran to matlab

From: James Tursa

Date: 25 Jun, 2008 23:22:02

Message: 4 of 4

"Sneha " <smithpamola@yahoo.com> wrote in message
<g3s1et$g8e$1@fred.mathworks.com>...
> Hello
>
> I have gone through google search, other forums and
similar
> message posted here also. I have not got really a way to
> convert f90 file to matlab file. Its really a big file.
> Can anyone please help me?
>
> Thanks.

Converting Fortran to MATLAB can sometimes be
straightforward, but a *lot* of Fortran stuff has no
direct translation to MATLAB, particularly some of the
newer F90/F95 stuff. You would need to understand
Fortran's pass-by-reference behavior (Fortran purists,
don't bite me on this please!) vs MATLAB's pass-by-value
for function calls, etc. when doing the translation. If
you don't know Fortran very well this could be a rather
large task for you to undertake. And if you have a very
big file as you indicate, then I would take Steven Lord's
suggestion and look into making it a mex routine. Several
people on this ng can help you with that if care to go
that route. Do you have a Fortran compiler available?

James Tursa

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com