How to interpolate NaN values
显示 更早的评论
I have Matrix A as:
A = [4 5 9 Nan 8 3 4 4
3 5 9 7 8 3 4 4
4 4 5 8 6 5 4 4
4 5 9 Nan 8 3 4 4
3 5 1 Nan 5 4 9 1
7 2 2 8 5 5 6 1
3 4 1 2 5 4 9 8
3 5 1 4 1 1 1 9
3 4 5 2 3 4 6 6
3 4 5 Nan 3 4 6 6];
There are some NaN values in column 4. I want to find similar rows in matrix A and give relevant value of their column 4 to those NaN cells. In case if all cells in a row aren't matching with the row of Nan, find the most matchable (perhaps weighting option).
Results can be similar to B:
B = [4 5 9 7 8 3 4 4
3 5 9 7 8 3 4 4
4 4 5 8 6 5 4 4
4 5 9 7 8 3 4 4
3 5 1 2 5 4 9 1
7 2 2 8 5 5 6 1
3 4 1 2 5 4 9 8
3 5 1 4 1 1 1 9
3 4 5 2 3 4 6 6
3 4 5 2 3 4 6 6];
% first and fourth rows Nan values got value 7 from second row because of most similarity % fifth row Nan value got value 2 from the seventh row because of most similarity % tenth row Nan value got value 2 from the ninth row because of exact similarity
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!