Path: news.mathworks.com!not-for-mail From: "Ulrik Nash" <uwn@sam.sdu.dk> Newsgroups: comp.soft-sys.matlab Subject: Creating a matrix from information in two other matrixes Date: Fri, 10 Dec 2010 13:46:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 29 Message-ID: <idtaut$j28$1@fred.mathworks.com> Reply-To: "Ulrik Nash" <uwn@sam.sdu.dk> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1291988765 19528 172.30.248.37 (10 Dec 2010 13:46:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 10 Dec 2010 13:46:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2106050 Xref: news.mathworks.com comp.soft-sys.matlab:694213 Hi Everyone, Suppose I have a matrix A A = [2 3 1;1 5 0] And another matrix B B = [2 1 3;2 1 3] Now I wish to create a matrix C, which looks like this C = [3 2 1;5 1 0] Notice that: The first line, first column of C contains that value in line one of A, corresponding to the 1 found in the first line of B. The first line, second column of C contains that value in line one of A, corresponding to the 2 found in the first line of B. The first line, third column of C contains that value in line one of A, corresponding to the 3 found in the first line of B. and so forth for other lines.... What code will create C from A and B? Kind regards, Ulrik.