想请教一下各位大佬,我想用Fortran读取txt文件,一共15行,第一行代表有几组数据,一组数据有七行,然后每七行进行赋值怎么实现,能不能帮我写一下
module typ_vis implicit none
type :: vis
integer::nlink !表示第几组
real*8 :: c1
real*8 :: c2
real*8 :: a1
real*8 :: a2
real*8 :: d1
real*8 :: d2 !spring parameters
end type vis
end module typ_vis
subroutine ReadLinkProp()
use typ_vis
implicit none
integer::I
integer::nOfsprng !表示一共几组
type(visdamper),allocatable::AllSprngProps(:)
if (.not.allocated(AllSprngProps)) then
allocate(AllSprngProps(100))
end if
open(55,file='vis.txt')
read(55,*) nOfsprng !读取一共多少组
!write(*,*) "nOfSprng", nOfSprng
do I=1, nOfSprng
read(55,*) AllSprngProps(I)%nlink, !读取第几组
1 AllSprngProps(I)%c1,
2 AllSprngProps(I)%c2,
3 AllSprngProps(I)%a1,
4 AllSprngProps(I)%a2,
5 AllSprngProps(I)%d1,
6 AllSprngProps(I)%d2,
end do
close(55)