MATLAB: Unexpected matlab operator Covariance

covarianceerrorstats

I'm trying to calculate the the covariance of a set of data using stats::covariance but I keep getting an error message saying 'Unexpected Matlab operator'. The code I used was:
stats::covariance([1, 2, 6, 9],[5, 9, 3, 7], Population])
I don't see the error in the code. Is there is another way of calculating the covariance?

Best Answer

stats::covariance is a MuPAD routine that cannot be called directly from MATLAB. Use
feval(symengine, 'stats::covariance', [1, 2, 6, 9], [6, 9, 3, 7], Population)