How can I find all zeros in a 2d matrix and change those values by interpolating with the closest available values ?
古いコメントを表示
採用された回答
その他の回答 (1 件)
Walter Roberson
2017 年 6 月 7 日
[gr, gc, gv] = find(A);
F = scatteredInterpolant(gr, gc, gv);
[br, bc] = find(~A);
replacements = F(br, bc);
A( sub2ind(size(A), br, bc) ) = replacements;
カテゴリ
ヘルプ センター および File Exchange で Interpolating Gridded Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!