keep getting error in the covariance: Subscript indices must either be real positive integers or logicals.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
David Young
2014-9-28
编辑:David Young
2014-9-28
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!