<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: All combinations from vectors</title>
	<atom:link href="http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:12:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Zoran Zegarac</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13942</link>
		<dc:creator>Zoran Zegarac</dc:creator>
		<pubDate>Mon, 29 Nov 2010 07:50:01 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13942</guid>
		<description>&lt;pre&gt;

Yes, Yuri what is pp?
I do not know if this would work with my impdance matrix problem. 
There are 3 varibles, and each can have a value from 1 to 3,
and all possible sets of 2 of this variables are:
11
22
33
12
13
21
31
23
32
All in all,  3*3= 9, which is easy to do manually.

Now, doing the same as above, but now with  6 variables, each one  can have value form 1 to 9, making a total  of
9*9*9*9*9*9=531441.
Has anybody got and idea, please?

Zoran

&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre>

Yes, Yuri what is pp?
I do not know if this would work with my impdance matrix problem.
There are 3 varibles, and each can have a value from 1 to 3,
and all possible sets of 2 of this variables are:
11
22
33
12
13
21
31
23
32
All in all,  3*3= 9, which is easy to do manually.

Now, doing the same as above, but now with  6 variables, each one  can have value form 1 to 9, making a total  of
9*9*9*9*9*9=531441.
Has anybody got and idea, please?

Zoran
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliza</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13534</link>
		<dc:creator>eliza</dc:creator>
		<pubDate>Fri, 23 Apr 2010 03:09:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13534</guid>
		<description>Yury, What is PP?</description>
		<content:encoded><![CDATA[<p>Yury, What is PP?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yury</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13485</link>
		<dc:creator>Yury</dc:creator>
		<pubDate>Thu, 25 Mar 2010 11:42:14 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13485</guid>
		<description>Let NN=[2 1 2] (each element is number of combinations) and we need matrix of all combinations such as: 
1 1 1
1 1 2
2 1 1
2 1 2
Here is solution:

&lt;pre class=&quot;code&quot;&gt;
for i=1:prod(NN)
  t=i-1;  
  for j=length(PP):-1:1
    M(i,j)=mod(t,NN(j))+1;
    t = fix(t/NN(j));
  end
end
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Let NN=[2 1 2] (each element is number of combinations) and we need matrix of all combinations such as:<br />
1 1 1<br />
1 1 2<br />
2 1 1<br />
2 1 2<br />
Here is solution:</p>
<pre class="code">
for i=1:prod(NN)
  t=i-1;
  for j=length(PP):-1:1
    M(i,j)=mod(t,NN(j))+1;
    t = fix(t/NN(j));
  end
end
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13439</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Thu, 25 Feb 2010 20:57:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13439</guid>
		<description>@Marina,

What you are asking for is not permutation exactly.  I am not sure that what you are asking for has a specific name in statistics, so you will have to write your own MATLAB code to solve this.  

It should not be too hard.  I am assuming none of the N groups that hold M objects is to be empty, and that every object is in a group.  If so, you can calculate how many different ways to group things without perms.m

Doug</description>
		<content:encoded><![CDATA[<p>@Marina,</p>
<p>What you are asking for is not permutation exactly.  I am not sure that what you are asking for has a specific name in statistics, so you will have to write your own MATLAB code to solve this.  </p>
<p>It should not be too hard.  I am assuming none of the N groups that hold M objects is to be empty, and that every object is in a group.  If so, you can calculate how many different ways to group things without perms.m</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marina Zahari</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13436</link>
		<dc:creator>Marina Zahari</dc:creator>
		<pubDate>Tue, 23 Feb 2010 23:27:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13436</guid>
		<description>I have tried to use perms.m for my problem but it didn&#039;t work. Suppose that we have 4 objects, A, B, C, and D. And I would like to assign them to 3 unique labels/ groupings - 1,2 or 3. So all possible unrepetitve combinations will be:

1 1 2 3 (meaning A and B in group 1, C in group 2 and D in group 3)
1 2 1 3
1 2 3 1
2 1 1 3
2 1 3 1
2 3 1 1.

perms.m gave me the extras,
1 1 3 2, 1 3 1 2,  1 3 2 1, 3 1 1 2, 3 1 2 1 and 3 2 1 1 which I do not need. For example 1 1 3 2 still assign A ann B in group 1.

If you could point me in the right direction,  I would greatly appreciate it.

Thank you
Marina</description>
		<content:encoded><![CDATA[<p>I have tried to use perms.m for my problem but it didn&#8217;t work. Suppose that we have 4 objects, A, B, C, and D. And I would like to assign them to 3 unique labels/ groupings &#8211; 1,2 or 3. So all possible unrepetitve combinations will be:</p>
<p>1 1 2 3 (meaning A and B in group 1, C in group 2 and D in group 3)<br />
1 2 1 3<br />
1 2 3 1<br />
2 1 1 3<br />
2 1 3 1<br />
2 3 1 1.</p>
<p>perms.m gave me the extras,<br />
1 1 3 2, 1 3 1 2,  1 3 2 1, 3 1 1 2, 3 1 2 1 and 3 2 1 1 which I do not need. For example 1 1 3 2 still assign A ann B in group 1.</p>
<p>If you could point me in the right direction,  I would greatly appreciate it.</p>
<p>Thank you<br />
Marina</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mithat Perköz</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13171</link>
		<dc:creator>Mithat Perköz</dc:creator>
		<pubDate>Tue, 02 Jun 2009 10:27:54 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-13171</guid>
		<description>Thank you very much, I was just looking for an algorithm like this!</description>
		<content:encoded><![CDATA[<p>Thank you very much, I was just looking for an algorithm like this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-12913</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Tue, 28 Oct 2008 17:15:41 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-12913</guid>
		<description>I think you need to look at the problem as such.  Each element of the vector can reside in exactly one of three bins.

3 * 3 * 3 * 3 or numBins ^ numElements

-Doug</description>
		<content:encoded><![CDATA[<p>I think you need to look at the problem as such.  Each element of the vector can reside in exactly one of three bins.</p>
<p>3 * 3 * 3 * 3 or numBins ^ numElements</p>
<p>-Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amanda</title>
		<link>http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-12910</link>
		<dc:creator>Amanda</dc:creator>
		<pubDate>Mon, 27 Oct 2008 18:40:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2007/03/02/all-combinations-from-vectors/#comment-12910</guid>
		<description>Doug,

I&#039;ve been struggling with a matlab problem of combinations and permutations for a while and came across your post here.  I thought you might be able to help me out.  


Let&#039;s say I have a vector say A =[1 2 3 4] and want to find every way I can choose all the elements of A to fit in some number of bins (let&#039;s say 3). Bin 1 could have (1, 2, 3), Bin 2 could have (4) or (0) and Bin 3 could have (4) or (0) as well. The problem isn&#039;t quite solved by &quot;nchoosek&quot; because each bin could have more or less elements than the previous bin and the element choice for each bin depends on the elements not already chosen. I know that the number of possible combinations is # of elements in A^#of bins (in this case 81), because I solved it out by hand. I am looking for an easier way! I&#039;m sorry if this sounds confusing!  

If you can point me in the right direction or offer me any help I would greatly appreciate it!  

Thank you,

Amanda Palazzo</description>
		<content:encoded><![CDATA[<p>Doug,</p>
<p>I&#8217;ve been struggling with a matlab problem of combinations and permutations for a while and came across your post here.  I thought you might be able to help me out.  </p>
<p>Let&#8217;s say I have a vector say A =[1 2 3 4] and want to find every way I can choose all the elements of A to fit in some number of bins (let&#8217;s say 3). Bin 1 could have (1, 2, 3), Bin 2 could have (4) or (0) and Bin 3 could have (4) or (0) as well. The problem isn&#8217;t quite solved by &#8220;nchoosek&#8221; because each bin could have more or less elements than the previous bin and the element choice for each bin depends on the elements not already chosen. I know that the number of possible combinations is # of elements in A^#of bins (in this case 81), because I solved it out by hand. I am looking for an easier way! I&#8217;m sorry if this sounds confusing!  </p>
<p>If you can point me in the right direction or offer me any help I would greatly appreciate it!  </p>
<p>Thank you,</p>
<p>Amanda Palazzo</p>
]]></content:encoded>
	</item>
</channel>
</rss>

