data = rand(N,2); %# generate random points
index = (rand(N,1) <= p); %# roll coins to pick with prob p
data(~index, :) = []; %# keep only selected points
plot(x(index),y(index),'r*');
dist=sqrt((data(1,1)-data(~index,1))^2+(data(1,2)-data(~index,2))^2); % ques is what to put for data(~index,:) 's first or any element?
If we have to find distance between any point of data=rand(N,2)
(say first) from any point of data(~index, :) = [];
(say first of this also), how can we use data(~index, :) = [];
matrix in following statement?
dist=sqrt((data(1,1)-data(~index,1))^2+(data(1,2)-data(~index,2))^2)
My question is as we are taking first element of data
as data(1,1)
and data (1,2)
, how do we take take first element of data(~index,:)
matrix?