From: "Ulrik Nash" <>
Newsgroups: comp.soft-sys.matlab
Subject: Matrix multiplication
Date: Mon, 6 Sep 2010 13:44:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <i62r75$4ge$>
Reply-To: "Ulrik Nash" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1283780645 4622 (6 Sep 2010 13:44:05 GMT)
NNTP-Posting-Date: Mon, 6 Sep 2010 13:44:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2106050
Xref: comp.soft-sys.matlab:667914

Hi Everyone,

Suppose I have a matrix A:

A = [1 2;3 4;5 6]

and B:

B = [1 2]

What I would like is to form a matrix C, by multiplying the first column in A by the first column in B, and the second column in A by the second column i B to obtain:

C = [1 4;3 8;5 12]

I have tried C = B.*A but this does not work, because the dimensions do not match. But is there not a simple operation, that allows me to form C?