
Re: data extraction from matrix to use in another matrix
Posted:
Oct 22, 2013 1:24 PM


I tried running it as you typed it and it gives me this error
?? Subscripted assignment dimension mismatch.
Error in ==> trial at 13 M(i,:)=[conn(i,:) Node(conn(i,2),2:end) Node(conn(i,3),3:end)];
This is what I tried to run..
disp('Number of elements?') nelem=11; conn=[1,5,2;2,2,3;3,3,4;4,4,7;5,3,7;6,3,6;7,6,2;8,5,2;9,1,5;10,5,6;11,6,7]; disp ('Elem # Node(a) Node(b)') disp(conn) Node=[1,0,0;2,2,0;3,4,0;4,6,0;5,1,1;6,3,1,;7,5,1]; disp ('Node # Xcoord Ycoord') disp(Node) disp ('Elem # Nodea Nodeb Nodeax Nodeay') M=zeros(length(conn),4); for i=1:length(conn) M(i,:)=[conn(i,:) Node(conn(i,2),2:end) Node(conn(i,3),2:end)]; end

