vb怎样把矩阵写入文本文件?怎样读出来赋给一个新矩阵?

矩阵都是5x5的

dim s(1 to 5,1 to 5) as integer
dim sLine as string
dim i as integer,j as integer
'写入
open "d:\test.txt" for output as #9
for i=1 to 5
sLine=""
for j=1 to 5
sLine=sLine & s(i,j) & space(1)
next j
print #9,sLine
next i
close #9

'读取
dim s(1 to 5,1 to 5) as integer
dim sLine as string,strt() as string
dim i as integer,j as integer
open "d:\test.txt" for input as #9
i=1
while not eof(#9)
lineinput #9,sLine
strt=split(sLine)
for j=1 to 5
s(i,j)=cint(strt(j))
next j
i=i+1
wend
close #9
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-10-01
打酱油的
第2个回答  2011-10-01
SST = rs.RecordCount
ReDim AA(1 To 8, 1 To SST) '将动态数组定义上下标
Do While Not rs.EOF
x = x + 1

内容

rs.MoveNext
Loop
第3个回答  2011-10-01
提问者:匿名
相似回答
大家正在搜