- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
i define a subroutine
but it no work
subroutine printrmat(matrix,row,column)
implicit none
integer row,column,,i,j
real(8) matrix(row,column)
do i=1,row
write(*,10) (matrix(i,j),j=1,column)
10 format(column(f))
end do
end subroutine
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi dousti,
try this (it works with Intel compilers but is not standard Fortran):
subroutine printrmat(matrix,row,column)
implicit none
integer, intent(in) :: row, column
real(8), intent(in) :: matrix(row,column)
integer :: i,j
do i=1,row
write(*,'(<column>ES16.8)') matrix(i,1:column)
end do
return
end subroutine
Regards, Johannes
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
The standard language offers an unlimited repeat count in format specifications, that can come in handy for these cases.
subroutine printrmat(matrix,row,column)
implicit none
integer, intent(in) :: row, column
real(8), intent(in) :: matrix(row,column)
integer :: i
do i=1,row
write(*,'(*(ES16.8))') matrix(i,:)
end do
end subroutine
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi IanH,
didn't know of that standard feature 'unlimited format repeat count' before. I've googled it and it was introduced with F08. It is implemented since Composer XE2011 in the Intel compilers.
https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/270542
Hopefully other compilers (e.g. gfortran, ...) support it also in the stable releases.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
hi friends
tanks very much
i found a solution for problem
write(*,10) (matrix(i,j),j=1,column)
10 format(100(f))
or
write(*,10) (matrix(i,j),j=1,column)
10 format(1000(f))
or
...
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi dousti,
good that you found a solution. But in my opinion it would be better to use 'unlimited format repeat count', '*', instead of the fixed number. In case you plan to use this print routine in future, you could avoid trouble later on...