问题描述
我正在尝试使用mean(A,1)
来获取矩阵A
的均值行,但出现错误.
I'm trying to use mean(A,1)
to get the mean row of a matrix A
, but am getting an error.
例如,尝试运行命令mean(eye(3), 1)
.
这给出了错误no method mean(Array{Float64,2},Int32)
.
For example, try running the command mean(eye(3), 1)
.
This gives the error no method mean(Array{Float64,2},Int32)
.
我可以找到有关mean
函数的唯一文档:
http://docs.julialang.org/en/release-0.1 /stdlib/base/#statistics
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])
计算整个数组v
的均值,或者可选地沿region
中的维计算.
Compute the mean of whole array v
, or optionally along the dimensions in region
.
什么是region
参数?
编辑:对于Julia 0.7及更高版本,请将其写为mean(v, dims=1)
.
EDIT: for Julia 0.7 and higher, write this as mean(v, dims=1)
.
推荐答案
必须与您的安装有关,mean(eye(3),1)
在这里可以正常工作.
It must be something with your installation, mean(eye(3),1)
works just fine here.
这篇关于矩阵的平均行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!