- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For example
program main integer m complex cjj complex matrix(3, 5) cjj=(0.0, 1.0) matrix(1, :)=2*cjj matrix(2, :)=2+1*cjj matrix(3, :)=5*cjj+6 open(16, file='data.txt') do m=1, 3 write(16, *)matrix(m, :) enddo close(16) end
The above code does not work well. What I want is that the data in the output file is the same as the dimension of the matrix.
For this case, the size of the matrix is 3*5. What I want is also there are 3 lines ,and each line has 5 values.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do not use list-directed WRITE when you require the output to be formatted in a certain way. The following will work with IFort for your program above:
write(16, '(*(F5.1,2x,F6.2))')matrix(m, :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 wrote:Thanks so much,
Do not use list-directed WRITE when you require the output to be formatted in a certain way. The following will work with IFort for your program above:
write(16, '(*(F5.1,2x,F6.2))')matrix(m, :)
Even though I have been using Fortran for many years. I still do not familiar with the Fortran output/input format. Could you please tell me, how to make the output of a complex number like:
(1.69E-004,4.06E-007)
Thanks,
Best regards,
Tai
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page