formats and implied do loops
From: Helge Avlesen (avle_at_ii.uib.no)
Date: 03/31/04
- Next message: Håkan Lane: "iostat=10?"
- Previous message: glen herrmannsfeldt: "Re: To "TAB" or not to "TAB""
- Next in thread: glen herrmannsfeldt: "Re: formats and implied do loops"
- Reply: glen herrmannsfeldt: "Re: formats and implied do loops"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Mar 2004 12:06:13 +0200
Hi,
trying to be lean&mean, I write
write(*,'(f0.3,1x,e9.3,1x,2(f0.3,1x))') ((h1(i,j),h2(i,j),h3(i,j),h4(i,j),i=1,im),j=1,jm)
but the format behaves weird columnwise; all compilers I throw this
at, formats this like
1.000 0.200E+01 3.000 4.000
1.000 2.000
3.000 4.000
1.000 2.000
...
the first line is ok, but then all I get is two columns. if I instead
do
write(*,'(4(f0.3,1x)') ((h1(i,j),h2(i,j),h3(i,j),h4(i,j),i=1,im),j=1,jm)
I get four nice columns as I want, and also expect from expressions
like the first. so, why does this happen? test code below.
-- Helge implicit none integer, parameter :: im=2, jm=2 integer i,j real, dimension(im,jm) :: h1,h2,h3,h4 h1=1 ; h2=2 ; h3=3 ; h4=4 write(*,'(f0.3,1x,e9.3,1x,2(f0.3,1x))') ((h1(i,j),h2(i,j),h3(i,j),h4(i,j),i=1,im),j=1,jm) end
- Next message: Håkan Lane: "iostat=10?"
- Previous message: glen herrmannsfeldt: "Re: To "TAB" or not to "TAB""
- Next in thread: glen herrmannsfeldt: "Re: formats and implied do loops"
- Reply: glen herrmannsfeldt: "Re: formats and implied do loops"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]