如何将多个向量(包含空向量)合并成一个新向量?



版本:2.00.8

我从一个窗口(一个arrayVector)中获取值(向量),并想将它们合并成一个新的向量。我尝试了函数flatten来实现我的计算逻辑,但是失败了。

x = [[1,2,3], [], [4], [5,6]]
flatten(x)

错误信息:

flatten(x) => Couldn't flatten the vector because elements of the vector has inconsistent type.

由于空向量而报告错误。

过滤空向量后使用函数flatten

x = [[1,2,3], [], [4], [5,6]]
flatten(x[flatten(x[,0]!=NULL)])

输出:

offset  0   1   2   3   4   5
0       1   2   3   4   5   6

最新更新