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,171
Registered: 6/7/07
Re: data extraction from matrix to use in another matrix
Posted: Oct 19, 2013 2:37 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 10/19/2013 1:30 PM, walter Mulvany wrote:
> dpb <none@non.net> wrote in message <l3uf4n$nm4$1@speranza.aioe.org>...
>> On 10/19/2013 11:03 AM, walter Mulvany wrote:
>> > I'm writing a code for finite element analysis and I don't know how to
>> > read a value from a matrix (A) and use it as a pointer to direct me to
>> > values in another matrix.
>> > Here is a sample of the problem.

>> ...
>>

>> > connectivity=[1,1,2;2,1,3;3,2,3]
>> ...
>> > coordinates=[1,0,0;2,2,0;3,1,2]
>> ...
>> > I need to read element's 1 node(a) which in this case is 1, and use
>> that
>> > 1 to direct me to the node 1, extract the x and y coordinate from node
>> > 1, and create a matrix.

>> ...
>>
>> Well, it's not clear which you're after, but it's simple enough to
>> find a location in an array by value and get the associated
>> information from some other for that.
>>
>> If ask for points in connectivity array that include node 1, that's
>> given by
>>

>> >> conn=[1,1,2;2,1,3;3,2,3];
>> >> coord=[1,0,0;2,2,0;3,1,2];
>> >> idx=any(conn==1,2) % row indices of any connections w/ a '1'

>> idx =
>> 1
>> 1
>> 0

>> >> coord(idx,:) % get those rows' coordinates...
>> ans =
>> 1 0 0
>> 2 2 0

>> >> coord(any(conn==1,2),:) % do it w/o the intermediate variable
>> ans =
>> 1 0 0
>> 2 2 0

>> >>
>>
>> Look in subject index for "logical addressing" ...
>>
>> --

> Thank you for your input.
> This program is supposed to work on a matrix of approximate 100 elements
> and what I'm looking for is that every time nodeax(i) iterate, it looks
> at the element (i), extract the value of the node (a), then with that
> value(ex: 3) it goes to the node 3 in the coordinates matrix and extract
> the (x) value of that node and creates nodeax matrix of size[2,nelem].
> Again, thank you for your help, and sorry, but I don't have any
> experience programming and this is my first program.


Well, that's the same thing as just demonstrated --

coord(coord(nodeax(i)==i),1)

I'm not certain what you mean by "creates nodeax matrix of
size(2,nelem)", sorry...

--




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.