I have a vector containing some points in 2-D space. I want MATLAB to plot these points with lines drawn from every point to every other point. Basically, I want a graph with al
Building on gnovice's example, a simpler more intuitive way of generating all pairs is using the nchoosek function:
%# random points
N = 10;
x = rand(1,N);
y = rand(1,N);
%# all possible combinations of the elements of [1:N] taken 2 at a time
pairs = nchoosek(1:N, 2)';
%'# plot points and lines
plot(x(pairs), y(pairs), '-bs', 'MarkerFaceColor','g', 'MarkerSize',10)