Calculating the Pairwise covariance: with NaN's
Show older comments
I am trying to calculate the pairwise covariance.
x=rand(100,36);
TheNaNC=randi([1 100],1,10);
TheNaNV=randi([1 36],1,10);
x(TheNaNC,TheNaNV)=NaN;
c2 = cov(x,'partialrows');
I get the following error message: 'Error using cov (line 64) The number of elements in x and y must match.'
Also tried:
c3 = cov(x,'omitrows');
'Error using cov (line 64) The number of elements in x and y must match.'
What am I doing wrong with this?
I am trying to calculate the covariance the why R calculate it but using MATLAB
4 Comments
Peter Mills
on 6 Dec 2017
Peter Mills
on 6 Dec 2017
Edited: Peter Mills
on 6 Dec 2017
Torsten
on 6 Dec 2017
The random integers should be drawn between 1 and 100 (1 and 36), not 0 and 100 (0 and 36).
Best wishes
Torsten.
Peter Mills
on 6 Dec 2017
Answers (0)
Categories
Find more on Interpolation of 2-D Selections in 3-D Grids 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!