Why do i get "Array indices must be positive integers or logical values"?

I'm trying to build covariance matrix C of the following matrix A and I'm getting the wrong message.
A = [ 44.8000 68.8000 11.4000 93.8000 93.8000 93.8000 15.8000; 55.7000 87.2000 12.9000 137.4000 137.4000 137.4000 18.8000; 59.1000 104.9000 20.7000 276.9000 276.9000 276.9000 21.4000; 63.4000 106.6000 20.1000 262.4000 262.4000 262.4000 21.7000; 70.7000 112.8000 30.2000 286.0000 286.0000 286.0000 27.7000; 88.0000 168.3000 71.1000 434.1000 434.1000 434.1000 39.5000]
Trial>> C=cov(A) Array indices must be positive integers or logical values.

Answers (2)

Rename and/or delete the variable named cov you've created that shadows the built-in cov function.
%No Error
A=[44.8000 68.8000 11.4000 93.8000 93.8000 93.8000 15.8000; 55.7000 87.2000 12.9000 137.4000 137.4000 137.4000 18.8000; 59.1000 104.9000 20.7000 276.9000 276.9000 276.9000 21.4000; 63.4000 106.6000 20.1000 262.4000 262.4000 262.4000 21.7000; 70.7000 112.8000 30.2000 286.0000 286.0000 286.0000 27.7000; 88.0000 168.3000 71.1000 434.1000 434.1000 434.1000 39.5000];
C=cov(A)

Asked:

on 2 Oct 2018

Commented:

on 2 Oct 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!