MATLAB Answers

Error while computing mean of a row vector

2 views (last 30 days)
rihab
rihab on 19 Aug 2015
Commented: Star Strider on 20 Aug 2015
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!

Accepted Answer

Star Strider
Star Strider on 19 Aug 2015
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 Comments
Star Strider
Star Strider on 20 Aug 2015
I still believe you’re shadowing the mean function somewhere in your code.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!