Fortran想先读取事先建好的txt文件,再把读取的数据赋值入矩阵中怎么编程序
让下面的矩阵A(15,15)第1行:0.75400.31800.21420.30240.18710.81460.06500.26240.37510.47840.07180...
让下面的矩阵A(15,15)
第1行:0.75400.31800.21420.30240.18710.81460.06500.26240.37510.4784
0.07180.35510.98760.35420.7777
第2行:0.07660.56800.67530.26240.72230.73560.19390.09560.87600.8937
0.80270.45460.25480.03690.3925
第3行:0.45950.95550.26420.71420.81880.19300.93000.70770.14330.9851
0.01340.95390.64150.20190.5993
第4行:0.19520.53350.97920.15070.21950.94470.35940.25800.09670.8004
0.83920.91420.75390.55130.1892
第5行:0.51300.09280.26610.40790.88110.24260.90070.84440.43120.1299
0.54660.81510.18170.34330.1248
第6行:0.55090.30750.43730.08490.89120.17840.46380.55050.82170.0200
0.90960.85770.70660.23440.3007
第7行:0.19990.65410.42910.61810.20380.60430.11610.11520.86630.5654
0.06960.58670.90740.14920.0743
第8行:0.21050.39870.79810.49320.86670.27380.07930.95540.24390.1850
0.59780.64450.32730.75020.3131
第9行:0.82290.57530.51860.54360.04480.29480.30580.16790.20260.7747
0.66850.11360.67170.95140.0323
第10行:0.62730.27680.90610.26460.82420.00550.00480.48450.02200.7470
0.98400.67360.79410.57420.4022
行11:0.94610.93100.53540.69850.12290.66960.57750.04300.96020.9198
0.70060.16170.00010.75820.7533
第12行:0.26930.50400.35650.49500.85530.03180.01330.36720.04270.0045
0.35080.83210.47710.32660.7360
第13行:0.44370.62640.50970.72910.61050.13670.14120.46900.71150.4645
0.81840.75150.67420.03650.3628
第14行:0.63970.18780.21190.78830.05010.15410.49490.52440.76790.8171
0.99500.90850.55690.31970.5292
第15行:0.76470.93030.44070.65080.30740.45320.47110.03320.84160.0492
0.87070.05530.13960.74510.0954
构造矩阵B(9,9)包含了A矩阵里以下的行和列:
行2 4 5 6 10 11 13 14 15
列: 3 4 7 8 9 11 12 13 15
写出矩阵B的迹数(矩阵B的主对角线(从左上方至右下方的对角线)上各个元素的总和)保留4位小数点想把A矩阵里的数据读入TXT文件,然后在TXT文件里读取B矩阵的行列,请问该怎么用FORTRAN实现。 展开
第1行:0.75400.31800.21420.30240.18710.81460.06500.26240.37510.4784
0.07180.35510.98760.35420.7777
第2行:0.07660.56800.67530.26240.72230.73560.19390.09560.87600.8937
0.80270.45460.25480.03690.3925
第3行:0.45950.95550.26420.71420.81880.19300.93000.70770.14330.9851
0.01340.95390.64150.20190.5993
第4行:0.19520.53350.97920.15070.21950.94470.35940.25800.09670.8004
0.83920.91420.75390.55130.1892
第5行:0.51300.09280.26610.40790.88110.24260.90070.84440.43120.1299
0.54660.81510.18170.34330.1248
第6行:0.55090.30750.43730.08490.89120.17840.46380.55050.82170.0200
0.90960.85770.70660.23440.3007
第7行:0.19990.65410.42910.61810.20380.60430.11610.11520.86630.5654
0.06960.58670.90740.14920.0743
第8行:0.21050.39870.79810.49320.86670.27380.07930.95540.24390.1850
0.59780.64450.32730.75020.3131
第9行:0.82290.57530.51860.54360.04480.29480.30580.16790.20260.7747
0.66850.11360.67170.95140.0323
第10行:0.62730.27680.90610.26460.82420.00550.00480.48450.02200.7470
0.98400.67360.79410.57420.4022
行11:0.94610.93100.53540.69850.12290.66960.57750.04300.96020.9198
0.70060.16170.00010.75820.7533
第12行:0.26930.50400.35650.49500.85530.03180.01330.36720.04270.0045
0.35080.83210.47710.32660.7360
第13行:0.44370.62640.50970.72910.61050.13670.14120.46900.71150.4645
0.81840.75150.67420.03650.3628
第14行:0.63970.18780.21190.78830.05010.15410.49490.52440.76790.8171
0.99500.90850.55690.31970.5292
第15行:0.76470.93030.44070.65080.30740.45320.47110.03320.84160.0492
0.87070.05530.13960.74510.0954
构造矩阵B(9,9)包含了A矩阵里以下的行和列:
行2 4 5 6 10 11 13 14 15
列: 3 4 7 8 9 11 12 13 15
写出矩阵B的迹数(矩阵B的主对角线(从左上方至右下方的对角线)上各个元素的总和)保留4位小数点想把A矩阵里的数据读入TXT文件,然后在TXT文件里读取B矩阵的行列,请问该怎么用FORTRAN实现。 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
展开全部
open(10,file='filename',action='read')
do i=1,15
do j=1,15
read(10,*)var(i,j)
end do
end do
do i=1,15
do j=1,15
read(10,*)var(i,j)
end do
end do
追问
你好,我补充了一下问题,能再帮忙解决一下,可以吗?
追答
直接打开一个文件读入
open(20,file='filename.txt',action='write')
do i=1,15
do j=1,15
write(20,"(15f)") (var(i,j),j=1,15)
end do
end do
close(20)
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询