Mean Row of Matrix

2019-03-06 10:35发布

I'm trying to use mean(A,1) to get the mean row of a matrix A, but am getting an error.

For example, try running the command mean(eye(3), 1).
This gives the error no method mean(Array{Float64,2},Int32).

The only documentation I can find for the mean function is here:
http://docs.julialang.org/en/release-0.1/stdlib/base/#statistics

mean(v[, region])

Compute the mean of whole array v, or optionally along the dimensions in region.

What is the region parameter?

EDIT: for Julia 0.7 and higher, write this as mean(v, dims=1).

标签: julia
1条回答
劳资没心,怎么记你
2楼-- · 2019-03-06 11:14

It must be something with your installation, mean(eye(3),1) works just fine here.

查看更多
登录 后发表回答