From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: k (3) Vectors of ones and zeros "combining" together
Date: Wed, 18 Jan 2012 02:14:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <jf59tg$jbs$>
References: <jf510f$nv5$> <jf51ot$q13$> <jf5309$a8$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1326852848 19836 (18 Jan 2012 02:14:08 GMT)
NNTP-Posting-Date: Wed, 18 Jan 2012 02:14:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:754988

"Apostol" wrote in message <jf5309$a8$>...
> but what if I need DIFFERENT combinations? I know for large values of N would be really long/difficult but I would need something that each time generates different combinations so I can evaluate different clusters.
> Thanks :)
- - - - - - - - - -
  This ought to make all possible combinations possible, and they are of equal probability:

 A = zeros(3,n);
 p = randperm(N);
 q = [1:3,ceil(3*rand(1,N-3))];
 A(q+3*(p-1)) = 1;

The three rows of A are your three vectors.  Each row has at least one 1 and each column has exactly one 1.

  (Note that each time you restart your matlab application it will generate the same sequence of pseudo random numbers unless you use 'randstream' methods.)

Roger Stafford