Concerning running Fortran prog from Octave
Ben Abbott
bpabbott at mac.com
Sun Mar 30 13:14:18 CDT 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/help-octave/attachments/20080330/dcf99ccf/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: do_triples.m
Type: application/octet-stream
Size: 452 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/help-octave/attachments/20080330/dcf99ccf/attachment.obj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/help-octave/attachments/20080330/dcf99ccf/attachment-0001.html
More information about the Help-octave
mailing list