I need to check cell value along each diagonal. then if condition which I have define is satisfying, cells which have NaN value should replace by interpolation of cells beside NaN value cells.
1 次查看(过去 30 天)
显示 更早的评论
for q=1:nBinsY-2
if q==1
for p=3:nBinsX
s=p;
for i = 1:s-1
j = p;
if ~isnan(minz(i,j)) && isnan(minz(i+1,j-1))
for jj=2:p-1
if ~isnan(minz(i+jj,j-jj))
dz=minz(i,j)-minz(i+jj,j-jj);
dx=minx(i,j)-minx(i+jj,j-jj);
dy=miny(i,j)-miny(i+jj,j-jj);
ddi=sqrt(square(dx)+square(dy));
if abs(dz)<1 && abs(ddi)<5
sl=dz/ddi;
ddx=dx/(jj);
ddy=dy/(jj);
for r=1:jj-1
minz(i+r,j-r)=minz(i,j)+(sl*r);
minx(i+r,j-r)=minx(i,j)+(ddx*r);
miny(i+r,j-r)=miny(i,j)+(ddy*r);
end
else
continue
end
else
continue
end
i=i+jj;
j=j-jj;
end
else
continue
end
p=p-1;
end
end
else
p=nBinsX
for i = q:p+1
j=p;
if ~isnan(minz(i,j)) && isnan(minz(i+1,j-1))
for jj=2:p-1
if ~isnan(minz(i+jj,j-jj))
dz=minz(i,j)-minz(i+jj,j-jj);
dx=minx(i,j)-minx(i+jj,j-jj);
dy=miny(i,j)-miny(i+jj,j-jj);
ddi=sqrt(square(dx)+square(dy))
if abs(dz)<1 && abs(ddi)<5
sl=dz/ddi;
ddx=dx/(jj);
ddy=dy/(jj);
for r=1:jj-1
minz(i+p,j-p)=minz(i,j)+(sl*r);
minx(i+p,j-p)=minx(i,j)+(ddx*r);
miny(i+p,j-p)=miny(i,j)+(ddy*r);
end
else
continue
end
else
continue
end
i=i+jj;
j=j-jj;
end
else
continue
end
p = p-1;
end
end
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!