How can I find all zeros in a 2d matrix and change those values by interpolating with the closest available values ?
조회 수: 5 (최근 30일)
이전 댓글 표시
For example, A=
댓글 수: 0
채택된 답변
Image Analyst
2017년 6월 8일
You could use regionfill(), if you have the Image Processing Toolbox, to do it in a single line of code:
outputArray = regionfill(inputArray, inputArray == 0);
댓글 수: 0
추가 답변 (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;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!