Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

output format help!

buffoon
Beginner
667 Views
I want to write an array to a file through a loop,

the fragment of program:
DO I=1,N
...
YL=Y(I)
WRITE(UNIT=1,FMT=*) YL
ENDDO

the result is each data in a new line
if I need the data to be written in a line,
how can I achieve that!
thanks!


0 Kudos
3 Replies
james1
Beginner
667 Views
Depends on variable type and actual format desired, but something like:

WRITE (UNIT=1, FMT="((X,I))") Y

without the DO loop. Replace (X,I) with whatever is desirable in your case.

James
0 Kudos
buffoon
Beginner
667 Views
> Depends on variable type and actual format desired,
> but something like:
>
> WRITE (UNIT=1, FMT="((X,I))") Y
>
> without the DO loop. Replace (X,I) with whatever is
> desirable in your case.
>
> James

I have tried that,but failed,
can you explain the statement in detail? Is the parameter optional and what does (X,I) mean ?
If the array Y is real and I want output them in format F5.3 with five number each line,how to achieve that?
thank you in advance!

0 Kudos
james1
Beginner
667 Views
I'd recommend looking FORMAT up in the product documentation (or your textbook) for a more detailed explanation.

James
0 Kudos
Reply