Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

 Messages: [ Previous | Next ]
 dpb Posts: 9,850 Registered: 6/7/07
Re: data extraction from matrix to use in another matrix
Posted: Oct 22, 2013 9:50 AM

On 10/22/2013 6:06 AM, walter Mulvany wrote:
> What I need to do is to go to element 1, read the value of (conn - column
>> 2) which is 5, go to the coord matrix, find the value (5) in its column 1
>> and extract the x value that correspond to that location (5) from (coord
>> - column 2) which in this case is (1).
>>
>> Those values can be stored in a matrix, lets call it M as you named it.

> When I do that I get this error
> ??? Subscripted assignment dimension mismatch.
>
> Error in ==> trial at 13
> M(i,:)=[conn(i,:) conn(find(conn(:,1)==coord(i,1)),:)];
>
> I know I have confused you a lot with my inexperience but if you can
> just give a last chance, I think that this is correct now. I've tried
> with other people at the university and nobody knows how to do it.

It's not the inexperience that's confusing, it's that you don't
seemingly proofread what you write so what you say isn't what you
(apparently) mean. Like confounding rows and columns--if you would try
to work through the prescription you'd have found that there's a
dichotomy there--there was no '5' in the 2nd row...

Now if the above is to be believed, you don't need to "find" the element
in coord==5 because the first column as you've defined it is the same as
the index therefore the index to the row is actually the value you just
found.

Again, I suggest you _carefully_ work through your verbal descriptions
and refine them until you can actually solve the problem on paper first
-- then the code to implement that solution will fall out...or, at a
minimum as suggested, cut the size down to only 3 or so in the conn()
array so it all fits on a screen conveniently and show the inputs and
desired outputs and how they relate.

--

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