Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!noose.ecn.purdue.edu!eurotunnel.ecn.purdue.edu!moshkovi From: moshkovi@eurotunnel.ecn.purdue.edu (Gennady Moshkovich) Newsgroups: comp.lang.fortran Subject: Implied do loop in write (SUMMARY) Message-ID: Date: 23 Apr 91 18:27:31 GMT Sender: root@noose.ecn.purdue.edu (ECN System Management) Organization: Purdue University Engineering Computer Network Lines: 48 Thanks everybody who sent me a reply on my posting. Here is summary of what I've got: 1) Number of replies suggested using of regular implied do loop in write statement. e.g. here line break is insured between separate lines do 1 i = 1,n write(6,100) (matrix(i,j),j=1,m) 1 continue 100 format(10i8) This way, however, is quite obvious, and it was implied in the original posting that the whanted one is the way to print _without knowing_ before values of m and n. 2) The way to do it is to use format string which are created after the value of m and n are determined. character*9 frmt data frmt/'(00f10.2/)'/ c when the value of m and n are determined, you need to change c format string as write(frmt(2:3),'(i2)')numcol c to write matrix: do 300 j=1,nrow write(6,frmt)(smatr(i,j),i=1,numcol) 300 continue c credits to howard@ee.utah.edu c Walt Howard Gene -- Gennady Moshkovich Purdue University Department of Civil Engineering moshkovi@ecn.purdue.edu