Re: How to print out a Fortran array?
- From: "Beliavsky" <beliavsky@xxxxxxx>
- Date: 17 Nov 2006 13:31:15 -0800
Thank you all. I was confused.
Now I still have a question: I have an array holding real type of data,
if I don't know its dimension(e.g. array size), can I write a loop to
print each item out? Something like the following?
DO 210 I=1, array_dimension_unknown
PRINT *, 'TSDATA(',I,')= ', TSDATA(I)
What value will you use for array_dimension_unknown?
What version of Fortran are you using? I strongly recommend Fortran 95
over Fortran 77.
The issue of which standard of Fortran to use is often discussed here.
If you are using Fortran 90 or 95, you can use the SIZE or SHAPE
intrinsic functions to determine the dimensions of an array in the main
program or in a procedure that has been passed as "assumed shape"
Unrelated matter -- in Fortran 90 and later versions the DO/CONTINUE
loop can (and I think should) be replaced by a DO/ENDDO loop. Even if
you are using a Fortran 77 compiler, it probably has the ENDDO feature.
Numbered lines should be avoided when possible.
- Prev by Date: Re: How to print out a Fortran array?
- Next by Date: Re: Find Fortran process memory in Linux
- Previous by thread: Re: How to print out a Fortran array?
- Next by thread: Re: How to print out a Fortran array?