it keeps showing error - index exceeds matrix dimension. why?

syms x; x=[182,155,175,165,140,220,90,180,140,200] mean=mean(x) maedian=median(x) mode=mode(x)

2 Comments

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.
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.

Sign in to comment.

Answers (0)

Tags

Asked:

on 27 Oct 2017

Commented:

on 27 Oct 2017

Community Treasure Hunt

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

Start Hunting!