mathematica 如何将数组写入文件,谢谢

如何将数组写入文件txt,以及如何将输出的文保存在自己写的mathematica文件的,同一个文件夹下面,比如nb 包装在桌面上,结果也输出到桌面上,谢谢
fname = FileNameJoin[{"P.txt"}];
s = OpenWrite[fname]
Write[s, #] & /@ Array[result, {3, 100}, 0]
Close[s]

楼上的,人家问的是Mathematica~~
代码:
SetDirectory[NotebookDirectory[]];
a = Table[i + j, {i, 1, 10}, {j, 1, 10}];
Export["a.txt", a, "Table"]
第一句设置默认路径为当前文件的路径,不过以上代码要先保存(这个自然,没有保存的文件的路径当然是不知道的,因此也就没法输出a.txt)。
最后一句的"Table"是控制输出为表格形式,这样美观些。具体用法你可以查看帮助文档。
温馨提示:内容为网友见解,仅供参考
第1个回答  2011-04-05
着就这么着
例:
<%
dim str,arr
str = "images/1.jpg,images/2.jpg,images/3.jpg"
arr = split(str,",")
for i=0 to ubound(arr)
response.write arr(i)&"<br />"
next
%>
相似回答