MATLAB: Nchoosek help

#nchoosekcombinationsvector

I am trying to figure out the nchoosek command but can't seem to get it. What I am trying to answer is if there are 4 people in a line, how many different ways can they be arranged. I tried nchoosek(1:4,4) but that returns the vector 1 2 3 4 and nchoosek(4,4) but that returns just a 1. What am I missing here?

Best Answer

Hi Sean, 4 people in a line is just factorial(4). nchoosek assumes you are interested in how many ways you can choose a number of objects out of set where order is not important. Note that arrangement in a circle is different.
Wayne