MATLAB: How to determine connectivity among elements? : <p>I am trying to determine how some elements are connected between one another by undestanding if they have a common coordinate.
I wrote the following code, but it is incorrect.</p>

<pre><code>   clc
   clear
   lines = {[0 0 0; 0 0 3], [0 0 3; 1 2 2], [0 0 0; 1 2 2], [5 3 3; 0 0 0], [1 2 2; 5 2 3]}
   connectivity = []
   i = 1
   for i = 1:length(lines)-1
   [Result,LocResult] = ismember(lines{i},lines{i+1},'rows')
   if nonzeros(Result) == 1
   A = [i,i+1]
   connectivity = [connectivity; A]
   i = i + 1
   end
   end
</code></pre>
