How to add multiple same rows in a array

Hi
I have a array P (1x41227) and I want to add 27856 rows with same elements like P.
how can I do it ?
thanks

1×41227 Array{Float64,2}:
0.0361328 -0.00634766 0.774414 0.620117 … 0.255859 0.491211 0.666992

You can do repeat(P, 27856)

2 Likes

You can use broadcasting, e.g.:

julia> A = rand(27856, 41227);

julia> P = rand(1, 41227);

julia> B = A .+ P    # adds P to each row of A
2 Likes

thanks :slight_smile: