MATLAB: What is the error

index exceeds matrix dimensions

when i run my program and try to get product of vector matrix error message appear
</matlabcentral/answers/uploaded_files/23122/Capture.PNG> but when i clear and try prod function there is no error

Best Answer

When you get the error, type this in the Command Window:
which prod -all
You may have a variable named ‘prod’ that is ‘overshadowing’ the MATLAB prod function.
If one (likely the first) in the list that returns in the Command Window is:
prod is a variable.
That is the problem. Rename that variable to something other than ‘prod’ and the problem will not recur.
Related Question