2
我在Julia有一個數組數組,我試圖找到將所有元素連接在一起的方法。如果我創建陣列並將它們分別輸入到hcat()
中,它將按照我的意願執行。但是,如果我創建數組,然後將數組數組提供到hcat()
,它將失敗。我可以寫一個循環來成功連接一個數組到另一個數組,但我想知道是否有更好的方法。數組連接數組
a = ones(2,2);
b = ones(2,2);
c = ones(2,2);
hcat(a,b,c) ## Does what I want by creating a single array. would be impracticable though for large number of objects.
d = Array(Array{Float64,2}, 3);
d[1] = a;
d[2] = b;
d[3] = c;
hcat(d) ## Still leaves me with an array of arrays, like before
[a b c] ## also does what I want
[f for f in d] ## Still leaves me with an array of arrays