Reputation: 414
I have 2 vectors of size 1x90.
I have to do the operator
diff=sum((V_new-V).^2);
But every time i do it i get the error:
Subscript indices must either be real positive integers or logical.
How can i fix this problem and prevent it from occurring again?
Upvotes: 1
Views: 2700
Reputation: 114816
make sure you did not step over the sum
function:
type
>> dbstop if error
run the code, it should stop in debugger when error occurred.
check what sum
is:
>> which sum
should return that sum
is a build-in function, but if you accidentally created a variable with that name, it will tell you that sum
is a variable.
DO NOT USE BUILT-IN FUNCTIONS' NAMES AS VARIABLES
Upvotes: 3