help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concerning running Fortran prog from Octave


From: Ben Abbott
Subject: Re: Concerning running Fortran prog from Octave
Date: Sun, 30 Mar 2008 14:14:18 -0400


On Mar 30, 2008, at 12:29 PM, george brida wrote:
Ok; I will be more precise:
I have the following program in Fortran for the triples test for symmetry. After looking to this program, you can remark that the program applied to a data in the following path 'C:\DATA.DAT' (look please to the lines after the first comments), my question is:
If I define y=randn(100,6) in Octave, is there a possibility to run the Fortran program from Octave for every column of y?
Best regards.
<triples test.txt>

I took a quick look.

I assume you just want to run "triples_test" from octave in the same way you would from a dos window?

If so, you can try the attached script.

It's not pretty, but should be enough to get you started.

Note, that to get your program to run properly on my Mac, I removed the "C:\" reference from the fortran code. For DOS you may need to make the change below, to my script.

 -     system ("./triples_test DATA.DAT > data.out");
 +     system ("triples_test DATA.DAT > data.out");

This script returns a column for each column of input.

It extracts a number from each line of output and returns the numeric values.

For example,

> x = do_triples(rand(10,6))
x =

    10.00000    10.00000    10.00000    10.00000    10.00000    10.00000
   120.00000   120.00000   120.00000   120.00000   120.00000   120.00000
    -0.12222    -0.00000     0.01111     0.08889    -0.05000     0.06111
     0.00450     0.01194     0.00644     0.00439     0.00860     0.00713
    -1.82280    -0.00000     0.13850     1.34230    -0.53920     0.72370

In any event, your fortran program is rather simple. It can easily be written directly in Octave.

Ben

Attachment: do_triples.m
Description: Binary data





reply via email to

[Prev in Thread] Current Thread [Next in Thread]