How to do in place concatenation of matrices

Maybe you could explain a little bit further the problem. Of course you can (not in-place) do

a = cat(a,b,dims=2)

and go on.

That could only be in place while keeping a contiguous in memory if there was some memory reserved for that growth in advance (is that what ElasticArrays does?). If there isn’t, either a has to be reallocated, or it would become split in memory, requiring multiple pointers, like a vector of arrays. If one or the other is best for performance depends on what is going to be made with a afterwards, but if it is going to be any heavy computation, probably reallocating it is the best choice.