CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Fortran write help (https://www.cfd-online.com/Forums/main/12872-fortran-write-help.html)

Praveen. C January 25, 2007 11:30

Fortran write help
 
I want to write a set of numbers on the same line.

write(*,*)(x(i),i=1,n)

works fine. But I want to control the format.

write(*,'(e20.10)')(x(i),i=1,n)

puts each number on a new line. Since n is variable I cannot hard code it into the format. Is there any way to achieve this in fortran 77 ?

Renato. January 25, 2007 13:15

Re: Fortran write help
 
try it:

write(*,999)(x(i),i=1,n) 999 format(e20.10,/)

Regards

Renato.


Markus Lummer January 26, 2007 00:20

Re: Fortran write help
 
Hello Praveen,

you could buildup the appropriate format string in a character variable.

Regards, Markus


All times are GMT -4. The time now is 13:58.