Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: data extraction from matrix to use in another matrix
Replies: 26   Last Post: Oct 22, 2013 4:57 PM

 Messages: [ Previous | Next ]
 walter Mulvany Posts: 14 Registered: 10/19/13
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

Date Subject Author
10/19/13 walter Mulvany
10/19/13 dpb
10/19/13 walter Mulvany
10/19/13 dpb
10/19/13 walter Mulvany
10/20/13 dpb
10/20/13 walter Mulvany
10/20/13 dpb
10/20/13 walter Mulvany
10/21/13 walter Mulvany
10/21/13 dpb
10/21/13 dpb
10/21/13 walter Mulvany
10/21/13 dpb
10/21/13 walter Mulvany
10/22/13 walter Mulvany
10/22/13 dpb
10/22/13 walter Mulvany
10/22/13 walter Mulvany
10/22/13 dpb
10/22/13 walter Mulvany
10/22/13 dpb
10/22/13 dpb
10/22/13 walter Mulvany
10/22/13 dpb
10/22/13 dpb
10/20/13 dpb