Concatenation of sorts

From: Pierre (lemair93_at_wharton.upenn.edu)
Date: 12/17/04


Date: Fri, 17 Dec 2004 14:54:44 -0500

Good day everyone -

Is it possible to use a local variable within a FORMAT statement to define
array size for WRITE command? ie, the following simplified subroutine to
WRITE a vector of size n1 to I/O unit1:

SUBROUTINE writeme(n1)
...
integer, intent (in) :: n1
integer :: counter

! matrix is defined globally as real(1:n2), where n2 .ge. n1
! need to write matrix(1:n1) on one row.
WRITE (UNIT = unit1, FMT = 2000) (matrix(counter), counter=1,n1)
2000 FORMAT (??F7.1)
END SUBROUTINE

I need something that will translate to FORMAT ('n1'F7.1), so that if n1=20,
20F7.1. Or a totally different approach if this is not going to work.

Thanks!

If it matters, I am using Intel Fortran Compiler 8.1 for Linux.