# Filling missing points in a grid

5 views (last 30 days)
fatoma Saml on 2 May 2021
Answered: Doddy Kastanya on 5 May 2021
Hi everyone
I am wondering if anyone can help to mark the missing points on the grid with (x) . I have a regular points in x,y that I get from executing the differences between a predeifined points to get the grid, at the same time, some points are missing and I want to mark them (x red) as shown in the figure (i.e, (7,8), and the other missing points I have execute the code
M=3; N=5;
mN=[0:M-1]*N;
nM=[0:N-1]*M;
[xx yy]=meshgrid(mN, mN);
[x y]=meshgrid(nM, nM);
L1=[xx(:),yy(:)];
L2=[x(:),y(:)];
LL=[0,0];
L1= union(L1, L2, 'rows');
L=union(L1,LL,'rows');
[xSort, xSortIdx] = sort(L(:,1));
ySort = L(xSortIdx,2);
N = length(L);
for i=1:N
for j=1:N
D(i,j) = xSort(i) - xSort(j) ;
D1(i,j)=ySort(i)-ySort(j);
end
end
V1=D(:); V2=D1(:);
D_t=[V1(:),V2(:)];
plot(D_t(:, 1),D_t(:,2) ,'square','color', 'b', 'markersize',5, 'linewidt',2);
I apperciate any help
Thanks

Doddy Kastanya on 5 May 2021
You could try to add the following at the end of your code:
hold on
text(7,8,'X','color','r')
If there are other points, then you could embed this in a for loop identifying the appropriate x and y position.