诀窍是将数组展平为2D数组:
import numpy as np a=np.zeros((2,3,4)) a[0,0,0]=10 b=a.reshape(1,24) np.savetxt("/matrix.CSV",b,delimiter=',')
然后在导入后在Mathematica中将其转换为3D,我们可以使用:
file=Import["matrix.CSV","Data"] matrix=ArrayReshape[file, {2, 3, 4}]