Asked by Hayden
on 6 Oct 2012

I am given a list of XYZ vertices (mx3 matrix) and a list of vertex connections (nx2 matrix, X and Y are a pairing of connected vertices.) I ultimately need to be able to plot a projection on the X-Y plane from this information, and while I've found a way on this site to do this using gplot and the adjacency matrix, I can't find anything on how to use MATLAB to take the list of vertex connections and convert it to an adjacency matrix. Obviously this can be achieved manually, and I've done so for a small cube to ensure the rest of the program works, but it needs to be done automatically for any lists that could be loaded.

I have absolutely no idea where to start, and would appreciate some guidance.

*No products are associated with this question.*

Answer by Walter Roberson
on 6 Oct 2012

Accepted answer

adjmatrix = zeros(m,m); for K = 1 : n p1 = vertices(K,1); p2 = vertices(K,2); adjmatrix(p1,p2) = 1; adjmatrix(p2,p1) = 1; end

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments