Saved Bookmarks
| 1. |
Is There Any Way To Use Variables In A Format Statement? |
|
Answer» Yes, but you have to use one format statement to build a SECOND using a write to a character string. For example if you WANT to include the value of "n" as the number of real numbers per line you would do the following: PARAMETER (N=4) CHARACTER FORM1*16 REAL A(N,N) DO 10 I=1,N DO 10 J=1,N A(I,J)=J*100+I 10 CONTINUE WRITE(FORM1,2000)N 2000 FORMAT('(1X,',I3,'F6.1)') WRITE(6,FORM1) A STOP ENDYes, but you have to use one format statement to build a second using a write to a character string. For example if you want to include the value of "n" as the number of real numbers per line you would do the following: |
|