I Thank you
i put the code in fortran 95 silver frost version as given below
and it compiles ok. But run time error format/data mismatch error shows line 25 error
that is WRITE(14,"(F0.1,5(1X,F0.2))")X(IROW,:)
The format string is only valid if X is declared real. In your code it is an array of type character. Here is a program that works with gfortran or Intel Fortran that reads the data into an array and writes it to a file.
program main
implicit none
integer, parameter :: nfields = 5, max_rows = 1000, dp = kind(1.0d0)
character (len=1000) :: title ! use a long length -- it will be trimmed later
real(kind=dp) :: x(max_rows, nfields)
integer :: ierr,irow, in_unit, out_unit
open (newunit=in_unit, file = "test4.txt", action = "read", status = "old")
open (newunit=out_unit, file = "result4.txt", action = "write", status = "replace")
read (in_unit,"(a)") title
write (out_unit,"(a)") trim(title)
do irow=1,max_rows
read (in_unit,*,iostat=ierr) x(irow,:)
if (ierr /= 0) exit
write (out_unit,"(f10.1,*(1x,f10.2))") x(irow,:)
end do
end program main
The output file contains
time isobaric lat lon u-component_of_wind_isobaric
0.0 10000.00 0.00 45.00 2.32
0.0 10000.00 0.00 45.12 2.41
0.0 10000.00 0.12 45.00 2.22
0.0 10000.00 0.12 45.12 2.35
0.0 10000.00 0.12 45.24 2.32
0.0 100000.00 0.12 45.36 -2.98
0.0 100000.00 0.12 45.48 -2.73
0.0 100000.00 0.00 45.00 -2.89
0.0 100000.00 0.00 45.12 -2.78
If you donβt need to store all the data the program could be simplified.