我有一个 .dat 文件,由一串数字 1 到 9 组成,如下所示:
1
2
3
4
5
6
7
8
9
如何将数据导入到 mathematica 中,使其具有 {{1,2,3},{4,5,6},{7,8,9}} 的形式,并且可以生成 3x3 矩阵?
最佳答案
我建议:
data=Partition[Import["<Name of data file>", "Table"],3];
关于file - 如何在 Mathematica 中将 .dat 文件作为矩阵导入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13746642/