I use this code to create and plot N points:
N
N = input(\'No. of Nodes:\'); data = rand(N,2); % Randomly generated n no. of nodes x = data(:,1);
randnum=ceil(rand(1)*N) %Sample a random integer in the range 0 to N your_node = [x(randnum),y(randnum)] %Here is the sampled node from your data set Edit: changed floor to ceil.