Error while computing mean of a row vector

4 次查看(过去 30 天)
I am getting the following error while finding out the mean of a row vector(using the mean function of matlab) containing ten elements:
Subscript indices must either be real positive integers or logicals.
Could any one tell me how to resolve this error?
Thank you!

采纳的回答

Star Strider
Star Strider 2015-8-19
In the Command Window, type:
which mean -all
If it returns:
mean is a variable.
among its path returns, you are ‘shadowing’ (or ‘overshadowing’) the mean function with a variable you named ‘mean’. The solution is to rename the variable to ‘meanx’ or some such.
  5 个评论
rihab
rihab 2015-8-20
I am getting the same error: Subscript indices must either be real positive integers or logicals.
But now I am calculating it in the traditional way,i.e taking the sum and dividing it by the total number of observations so no longer a problem for me!
Star Strider
Star Strider 2015-8-20
I still believe you’re shadowing the mean function somewhere in your code.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by