- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
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!
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
WRITE (UNIT=1, FMT="(
without the DO loop. Replace (X,I) with whatever is desirable in your case.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> 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!
> but something like:
>
> WRITE (UNIT=1, FMT="(
>
> 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
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd recommend looking FORMAT up in the product documentation (or your textbook) for a more detailed explanation.
James
James

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page