Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,231
Registered: 6/7/07
Re: data extraction from matrix to use in another matrix
Posted: Oct 20, 2013 10:45 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 10/19/2013 6:42 PM, walter Mulvany wrote:
> My mistake, that matrix is wrong.
> I tried what you suggested but I could not get it to work.
> here is how the final matrix should look like.
> Number of elements?
> Elem # Node(a) Node(b)
> 1 1 2
> 2 2 3
> 3 3 4

...
> 10 5 6
> 11 6 7
>
> Node # X Y
> 1 0 0
> 2 2 0
> 3 4 0

...
> 7 5 1
>
> Final global matrix
> Elem # Nodea Nodeb Nodeax Nodeay
> 1 1 2 0 0
> 2 2 3 2 0
> 3 3 4 4 0

...
> 11 6 7 3 1
>
> each element has a node(a) and (b), each node(a) have a x and a y
> coordinate, but some elements repeat the same node (a). As I said, I'm
> very new at Matlab and don't have experience programming.
> Can you show me how to type it correctly so that it works?

...

Sure...using just the last two columns for the node/conn matrices
(there's no sense in storing a linear index as well; you can generate it
for display easily enough), then the result M is simply given by--

>> M=zeros(length(conn),4); % preallocate (don't store the index)
>> for i=1:length(conn),

M(i,:)=[conn(i,:) node(conn(i,1),:)];
end
>> M
M =
1 2 0 0
2 3 2 0
3 4 4 0
4 7 6 0
3 7 4 0
3 6 4 0
6 2 3 1
5 2 1 1
1 5 0 0
5 6 1 1
6 7 3 1
>>

--



Date Subject Author
10/19/13
Read data extraction from matrix to use in another matrix
walter Mulvany
10/19/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/19/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/19/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/19/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/20/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/20/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/20/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/20/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/21/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/21/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/21/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/21/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/21/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/21/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/22/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/22/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/22/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/22/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/22/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/22/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/22/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/22/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/22/13
Read Re: data extraction from matrix to use in another matrix
walter Mulvany
10/22/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/22/13
Read Re: data extraction from matrix to use in another matrix
dpb
10/20/13
Read Re: data extraction from matrix to use in another matrix
dpb

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.