Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: combinations of N matrixes taken K at a time
Date: Sun, 11 Oct 2009 16:50:24 +0000 (UTC)
Organization: Battelle Energy Alliance (INL)
Lines: 9
Message-ID: <hat2cg$6gu$1@fred.mathworks.com>
References: <hat0le$jeq$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255279824 6686 172.30.248.38 (11 Oct 2009 16:50:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 11 Oct 2009 16:50:24 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 688530
Xref: news.mathworks.com comp.soft-sys.matlab:576529


Store your matrices in a cell array, then use nchoosek with numeric arguments to index into the cell.

A = {rand(2) rand(2) rand(2)}
t = nchoosek(1:3,2)

G = cell(size(t,1),1);
for ii = 1:size(t,1)
    G = A(t,ii,1) * A(t,ii,2);  % Or whatever here.
end