From: Tobias Burnus on
On 05/26/2010 05:26 PM, baalzamon.moridin wrote:
> [...]however, I do not have a fortran compiler.

That can easily be solved: Simply install a free one, e.g.,

gfortran (
g95 (

From: steve on
On May 26, 8:26 am, "baalzamon.moridin" <baalzamon.mori...(a)>
> I've tried a few rather simple tutorials, however, I do not have a
> fortran compiler.
> Furthermore I really do not want to end up having to learn fortran
> beyond what i need for translation.
> Though I will act upon your advice and look up some more tutorials.

If you do not have a Fortran compiler, how are you going to
test that your Matlab translation gives the same result as
the original Fortran code?

gfortran and g95 are free compilers.

There are a few commercially available compilers that provide a
'free' version under certain conditions (e.g., academic research
or noncommercial use). Silverfrost is one such compiler.

If the code is Fortran 77, you might take a peek at a book
written by Clive Page. It can be found at
search for "Professional Programmer's Guide to Fortran77"
on the page. It a fairly concise book and with your
background in Matlab, I suspect you could read it in
a few hours.


From: dpb on
baalzamon.moridin wrote:
> Howdy there,
> I am converting some fortran 77 code into matlab. There are various
> questions that have cropped up. As I prgress through my conversion
> process i will add them to this topic. For now my first question is;
> What is 0.0D0?

That is a DOUBLE PRECISION constant (as opposed to single, default
floating point constant). W/O the "D", it is single precision.

For a zero value, promotion to a double will still leave precisely zero;
the difference occurs when the value is not exactly representable.
Fortran will convert the single precision value to double on an
assignment, but it is a single precision value in a double precision
variable on doing so for a loose way of saying it.

IOW, in general, the "D" is important for doubles.

Here's a case where in Matlab it won't matter so much; Matlab uses
double as it's default data type and so the effect of the "D" is gained
implicitly w/o being specifically required.

Given the questions you've asked in cs-sm and now this, you clearly need
to start by finding a Fortran reference from the uni library or at a
minimum link to the online manual of a compiler to be able to look up
such stuff.


From: baalzamon.moridin on
With regards to testing, I have exe files of the original code.
Thus I can test if my code yields the same results.
I intend to write two versions,
(i) Full conversion,
(ii) Call the fortran code directly.
Both will be tested for results.

On a side note, one of my codes uses Assign a lot. Any ideas on
what this does?
From: Richard Maine on
baalzamon.moridin <baalzamon.moridin(a)> wrote:

> On a side note, one of my codes uses Assign a lot. Any ideas on
> what this does?

Oh, yukk! Assign is a bit of an abomination from the past, which is no
longer in the language. Although simple enough in some ways, assign has
an arcane collection of warts with surprising consequences. If used
sparingly and in simple ways, it might not be too bad and can readily be
translated into other constructs. But if a program uses it "a lot", I'd
take that as a bad sign. Most programs I have seen that used it "a lot"
were the kind of incomprehensible mess that was best handled by throwing
them out and restarting from scratch.

The short version is that assign assigns an integer variable with a
value that is a statement label. You can then subsequently use that
integer variable in a few limitted contexts as a stand-in for that
statement label.

Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain