Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem in output configuration

Status
Not open for further replies.

zamaniM

Programmer
Jul 10, 2011
12
Hi everybody
I’m new in this forum and need your help .
I wrote a code that calculates 7 variable in 24 hours. The output should be in the shape of a 24*7 matrix; but the problem is that 6th and 7th elements of each column printed at next row. Is this the print format problem or because of limited space?


do i=1,24
write(3,*) (d(i,j),j=1,7)
end do

part of output:
0.0000000E+00 3.000000 1.5061725E-03 5.000000 4.0590329E-08
153.5291 6.1136034E-11
1.000000 6.000000 2.9736047E-03 10.00000 4.8737043E-08
150.1761 1.4492470E-10
2.000000 9.000000 4.2665242E-03 15.00000 5.8291679E-08
141.8717 2.4870286E-10
3.000000 12.00000 5.1464071E-03 20.00000 6.9457322E-08
131.1393 3.5745565E-10
4.000000 15.00000 5.0151492E-03 25.00000 8.2460247E-08
119.3483 4.1355044E-10
5.000000 18.00000 1.5955655E-03 30.00000 9.7551826E-08
107.1418 1.5565033E-10
6.000000 21.00000 -3.0037796E-02 35.00000 1.1501047E-07
94.88012 -3.4546610E-09
7.000000 24.00000 5.1914085E-02 40.00000 1.3514362E-07
82.84258 7.0158577E-09
8.000000 27.00000 3.4364481E-02 45.00000 1.5828992E-07
71.33862 5.4395510E-09
9.000000 30.00000 3.2323807E-02 50.00000 1.8482133E-07
60.80721 5.9741292E-09
10.00000 33.00000 3.2989457E-02 55.00000 2.1514536E-07
51.93984 7.0975288E-09
11.00000 36.00000 3.4757476E-02 60.00000 2.4970734E-07
45.77986 8.6791969E-09
12.00000 39.00000 3.7267156E-02 65.00000 2.8899282E-07
43.52947 1.0769940E-08
13.00000 42.00000 4.0550388E-02 70.00000 3.3352984E-07
45.77986 1.3524764E-08



 
Replace

write(3,*) (d(i,j),j=1,7)

by (for instance)

write(3,"(7(1X,1PE14.7))") (d(i,j),j=1,7)



François Jacq
 
Thank so much for reply ,Dear Francois jacq.

It works correctly now.I tried another format formerly but saw a runtime error :

write(3,"(7(1x))") (d(i,j),j=1,7)


severe(60): infinite format loop


Do you know what's the reason?
 
Yes : the format is wrong. As you print out real values, you need at least one format for theses values. In my example, I gave the format 1PE14.7

Your format just says to print seven spaces (1X means one space)... You forget the values !

François Jacq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top