keep getting error in the covariance: Subscript indices must either be real positive integers or logicals.
1 view (last 30 days)
Show older comments
I keep getting this error in calculating the covariance between two variables, how should I do it to avoid the error?
Subscript indices must either be real positive integers or logicals.
Error in model7 (line 84) cov = cov(M, W);
0 Comments
Accepted Answer
David Young
on 28 Sep 2014
Edited: David Young
on 28 Sep 2014
It looks as if you have used cov as the name of a variable.
Do
which cov
to see if this is the case. You should see a path ending in "cov.m". If you do not, look through your code to find where cov has been used as a variable and consistently change the name of all occurrences of the variable. The editor can help you do this quickly.
Once you have fixed your code, you may need to use the command
clear cov
before running it again.
0 Comments
More Answers (0)
See Also
Categories
Find more on Descriptive Statistics 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!