MATLAB: Sum function not working

function nameshadowshadow functionsum

when I enter:
sum([1 2 3])
i get the error message: Index exceeds matrix dimensions.
This seems like a bug.

Best Answer

You've probably used sum as a variable. Check in your code, you will find that sum was used as a variable. Clear the variable sum then use again the sum function
clear sum
sum([1 2 3])