|
"Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <idtq89$62p$1@fred.mathworks.com>...
> Hi Everyone,
>
> I know it is probably bad manners to start this post anew. But given that there was much confucion in the old thread, I hope it is okay just this once.
>
> Suppose I have a matrix A
>
> A = [2 3 1;1 5 0]
>
> And another matrix B
>
> B = [2 1 3;2 3 1]
>
> Now I wish to create a matrix C, which looks like this
>
> C = [3 2 1;0 1 5]
>
> The procedure that creates C is in words as follows:
> C(1,1):
> "Look at B's row 1. Locate the number 1. Find the corresponding number i A. Answer=3"
> C(1,2):
> "Look at B's row 1. Locate the number 2. Find the corresponding number i A. Answer=2"
> C(1,3):
> "Look at B's row 1. Locate the number 3. Find the corresponding number i A. Answer=1"
> C(2,1):
> "Look at B's row 2. Locate the number 1. Find the corresponding number i A. Answer=0"
> C(2,2):
> "Look at B's row 2. Locate the number 2. Find the corresponding number i A. Answer=1"
> C(2,3):
> "Look at B's row 2. Locate the number 3. Find the corresponding number i A. Answer=5"
>
> What code will generate C in general. In other words, the example shows rows of 2 and columns of 3. But what is there are r rows and c columns (in both A and B)?
>
> Kind regards,
>
> Ulrik.
>
See the solutions in your other thread. Also, your example is wrong - as I explained in the other thread!
|