首先构造一个10×10的二维数组,然后分别测试不经过字符化直接输出以及经过字符化后输出,相关命令流及测试结果如下:
;export the array directly
model new
;fill the array
fish def afill
array var(10,10)
loop m(1,10)
loop n(1,10)
var(m,n) = m*n
endloop
endloop
end
;export the array
fish def aexp
status = file.open('test1.txt',1,1)
status = file.write(var,10)
status = file.close
end
图1 直接输出数组元素结果图
array elements to strings
model new
the array
fish def afill
array var(10,10)
loop m(1,10)
loop n(1,10)
m*n =
endloop
endloop
end
@afill
the array
fish def aexp
array exp(10)
count = 0
loop m(1,10)
count = count + 1
msg = ''
loop n(1,10)
msg = msg + ' ' + string(var(m,n))
msg =
endloop
endloop
file.open('test2.txt',1,1) =
status = file.write(exp,10)
status = file.close
end
@aexp
图2 字符化后输出数组元素结果图-1
图3 字符化后输出数组元素结果图-2