Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

How to compute the correlation between elements in an array of arrays?

$
0
0

@zxjroger wrote:

Suppose that I have the following array of vectors.

temp = Matrix{Vector{Float64}}(undef, 3, 1000)
for i = 1:3
    for j = 1:1000
        temp[i,j] = rand(10)
    end
end

Now I want to compute the correlation between the first element in the inner-vector and the second element in the inner-vector, separately for each row dimension of the outer-matrix. I was trying to do something like this:

cor(temp[1,:][1,:], temp[1,:][2,:])

But temp[1,:][1,:] only gives me the first vector , rather then collecting horizontally the first elements in all vectors in the first row of the outer-matrix.

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles