Variable format

大城市里の小女人 提交于 2019-11-28 14:23:28

The syntax you are trying to use is non-standard, it works only in some compilers and I discourage using it.

Also, forget the FORMAT() statements for good, they are obsolete.

You can get your own number inside the format string when you construct it yourself from several parts

character(80) :: form
form = '(          (i10,1x))'
write(form(2:11),'(i10)') matrix

write(*,form) A

You can also write your matrix in a loop per row and then you can use an arbitrarily large count number or a * in Fortran 2008.

do i = 1, matrix
  write(*,'(999(i10,1x))') A(:,i)
end do

do i = 1, matrix
  write(*,'(*(i10,1x))') A
end do

Just check if I did not transpose the matrix inadvertently.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!