从两个文件导入创建 table
creating table from import from two files
我刚开始使用 Wolfram Mathematica。
我有两个带有数字的文件:
x=Import["c"\.path here..\x.txt","Table"];
y=Import["c"\.path here..\y.txt","Table"];
现在我有两个 tablex 和 y。我想合并然后有一个 table
{{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}}
我可以使用 ListPlot
构建图形。
我试过使用类似的东西
num={};
l1=length[x]; l2=length[y];
Do[num=Append[num,Partition[x[[i]],1]],Append[num,Partition[y[[i]],1]],{i,l1}]
那我该怎么做呢?
我找到了答案
t=MapThread[List,{x,y}]
就是这样,简单又简短
更短,在我的机器上大约。比 :
快 2 倍
t = Thread[{x, y}]
与 by agentp中给出的答案没有速度差异。
我刚开始使用 Wolfram Mathematica。
我有两个带有数字的文件:
x=Import["c"\.path here..\x.txt","Table"];
y=Import["c"\.path here..\y.txt","Table"];
现在我有两个 tablex 和 y。我想合并然后有一个 table
{{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}}
我可以使用 ListPlot
构建图形。
我试过使用类似的东西
num={};
l1=length[x]; l2=length[y];
Do[num=Append[num,Partition[x[[i]],1]],Append[num,Partition[y[[i]],1]],{i,l1}]
那我该怎么做呢?
我找到了答案
t=MapThread[List,{x,y}]
就是这样,简单又简短
更短,在我的机器上大约。比
t = Thread[{x, y}]
与