concatenate array in julia

2019-07-28 16:32发布

How can I concatenate two-dimensional arrays in Julia?

They are of type Array{UInt8, 2}.

I have tried hvcat(), but I get the error message

LoadError: MethodError: no method matching hvcat(::Array{UInt8,2}, ::Array{UInt8,2})

Any help would be much appreciated.

2条回答
Fickle 薄情
2楼-- · 2019-07-28 17:04

How exactly do you want to concatenate them? The following, for example, both work:

A = rand(UInt8, 2,2)
B = rand(UInt8, 2,2)

C = [A B]
D = [A ; B]
查看更多
放我归山
3楼-- · 2019-07-28 17:10

Two 2-D arrays of type UInt8 can be concatenated like this:

C = cat(1, array1, array2)
查看更多
登录 后发表回答