How do omit values in Matlab when taking R values?

I have a matrix of El Nino Data with Precipitation Data. I have to find the correlation coefficient between El Nino and Precpitation. Some of the precipitation data that came is displayed as -9999 for not recorded.
When writing corrcoef(), how do I do it to where it will omit those elements that have the -9999's in it?

답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 12월 2일

0 개 추천

So something like:
x = 1:10;
y = 3*(x)+7+rand(1,10)*2; %y = linear function of x plus noise
x([3 7]) = -9999;
corrcoef(x(x~=-9999),y(x~=-9999))

카테고리

도움말 센터 및 File Exchange에서 Weather and Atmospheric Science에 대해 자세히 알아보기

질문:

2011년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by