corr(x,y) nan
2 次查看(过去 30 天)
显示 更早的评论
Hello, I am trying to run a correlation using corr(x,y), but my dataset has NaNs in it, for different participants (beginner coder here).
For example, my dataset and code may look like this:
a = [78 88 87 54 68 91 72 nan 88 nan];
b = [nan 35 42 44 67 55 nan 34 25 33];
x = ~isnan(a);
y = ~isnan(b);
[r,p] = corr(x,y)
The result is a table full of NaN in the ouptut.
I am trying to get the r value and the p value. Would there be another way to achieve this?
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!