Re: WRITE, FORMAT problem
- From: Ian Bush <I.J.Bush@xxxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 10:07:15 +0000
Hi Alex,
aborel@xxxxxxxxxxxxxxxxxxxx wrote:
Hello everybody
I have a problem with the formatting of a write statement.
I am manipulating large data arrays (matrices) and I try to write out
the data as being semicolon separated. Since the array dimensions are
input, the format statement can not be hard coded.
I tried (n_rows and n_columns are input):
do i=1,n_rows,1
do j=1, n_columns,1
write(unit=201,fmt="(<2*n_columns>a)"), &
trim(adjustl(arr_data(i,j))), char(59)
end do
end do
and I get as result
[Loadcase ID];
Time Step;
XTP;
YTP;
ZTP;
XTS;
YTS;
ZTS;
XBP;
YBP;
...
But what I want as a result is
[Loadcase ID];Time Step;XTP;YTP;ZTP;XTS;YTS;ZTS;XBP;YBP;...
...
Two ways as your using F90 or later, as shown by trim and adjustl:
1) look into Advance='No' in you fortran reference book ( you do have one
dont you ? Those trees dies for a reason ! ) Totally untested but
it would be something like
Do i = 1, n_rows
Do j = 1, n_columns
Write( 201, '( a )', Advance = 'No' ) &
Trim( Adjustl( arr_data( i, j ) ) )
End Do
End Do
Write( 201, * )
2) Remember the format descriptor is just a character expression, so you can
construct your own by using a character variable ( this is valid F77 as well ),
Hope this helps
Ian
.
- References:
- WRITE, FORMAT problem
- From: aborel
- WRITE, FORMAT problem
- Prev by Date: Re: WRITE, FORMAT problem
- Next by Date: Re: pass several filenames to the subroutine
- Previous by thread: Re: WRITE, FORMAT problem
- Next by thread: Re: WRITE, FORMAT problem
- Index(es):
Relevant Pages
|
|