Hi,
I have very large matricies but will abbreviate them as best as possible here.
I have a matrix called "connectivity" which contains 5884 rows (total_elements = 5884) and 5 columns. The first column is the element number, the second column is node 1 and the third column is node 2:
connectivity(total_elements, 5); connectivity(:,1) = 1:total_elements;connectivity(:,2) = N1;connectivity(:,3) = N2;
making this matrix look like
1 900 1752 175 2003 200 1454 145 300...
I have a second matrix "C" which has the x and y coordinates for each of the nodes.
NodeNumber Xcomponent Ycomponent
…
I need to write a loop that will search matrix "C" for the correct x and y coordinates for each node and create a new matrix "length," which looks like the following:
length = zeros(total_elements, 7); length(:,1) = 1:total_elements length(:,2) = N1; length(:,3) = N2; length(:,4) = x1; %x coordinate of node 1
length(:,5)=x2; %x coordinate of node 2
length(:,6)=y1; %y coordinate of node 1
legnth(:,7)=y2; %y coordinate of node 2
being:
element# N1 N2 x1 x2 y1 y2
Best Answer