且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将每个循环中的数据存储到数组或表格中?

更新时间:2023-01-06 19:12:43

尝试使用 Table 而不是两个 For 循环.它返回结果列表的列表(基本上是一个矩阵)

Try using a Table instead of two For loops. It returns a list of lists of the results (a matrix basically)

Table[
 abc = doc[[n]];
 kk = doc[[m]];
 v = vector[abc, kk];
 vl = VectorLength[v], {n, 1, 5}, {m, 1, 5}]