Wolfram mathematica 从两个文件导入创建表
我刚开始使用Wolfram Mathematica。Wolfram mathematica 从两个文件导入创建表,wolfram-mathematica,Wolfram Mathematica,我刚开始使用Wolfram Mathematica。 我有两个带数字的文件: x=Import["c"\.path here..\x.txt","Table"]; y=Import["c"\.path here..\y.txt","Table"]; 现在我有两张桌子x和y。我想合并,然后有一张桌子 {{x1,y1},{x2,y2},{x3,y3},{x4,y4} 我可以使用ListPlot构建图形。 我试过用类似的东西 num={}; l1=length[x]; l2=length[y];
我有两个带数字的文件:
x=Import["c"\.path here..\x.txt","Table"];
y=Import["c"\.path here..\y.txt","Table"];
现在我有两张桌子x和y。我想合并,然后有一张桌子
{{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}]
它简单、短短,在我的机器上比:
答案在速度上没有差别。甚至更短的
转置[{x,y}]
t = Thread[{x, y}]