矩阵的平均行 [英] Mean Row of Matrix

查看:111
本文介绍了矩阵的平均行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用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.

这篇关于矩阵的平均行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆