it keeps showing error - index exceeds matrix dimension. why?
Show older comments
syms x; x=[182,155,175,165,140,220,90,180,140,200] mean=mean(x) maedian=median(x) mode=mode(x)
2 Comments
Adam
on 27 Oct 2017
I don't use the Symbolic toolbox so not sure exactly what works on it and what doesn't, but certainly naming a variable the same as the function you are calling to get that result is not a good idea. Naming any variable the same as any function is bad.
Star Strider
on 27 Oct 2017
That runs for me without error in R2017b, so the problem is exactly as Adam states it: you have previously named a variable ‘mean’, ‘median’, or ‘mode’, and that is throwing the error.
The solution is to go back and rename the variable so that it does not conflict with those function names.
Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!