> Date: Wed, 26 Mar 2003 14:54:17 +0000
> Reply-to: Fortran 90 List <[log in to unmask]>
> From: David Byrne <[log in to unmask]>
> Subject: flexible format statements
> To: [log in to unmask]
> Any thoughts on the following formatting
> issue would be much appreciated:
>
> I have a program where several vectors are
> of length determined by a parameter
>
> integer,parameter :: n=10
> real,dimension(n) :: vector
>
> and I write these to files at several places.
> I'd like to have a format statement that
> adjusts to the parameter, like
>
> write(unit=*,fmt=1)
> 1 format(1x,n(f10.8,1x))
>
> but this doesn't work.
> In other words, I don't want to have to go through
> the code and change 10's to 20's when n changes to 20.
Write:
1 format(1x,100(f10.8,1x))
or use an internal WRITE to prepare a format specification.
> Thanks a lot.
|