Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How to these permutations?

Asked by S. David on 27 May 2012


Suppose I have a vector of N elements, and I need to find all possible permutations {N \choose n} for n=1,2, ..., N. How can I do that?

Example: Suppose I have the vector [1 2 3], then all possible permutations are: 123 (n=3), 12, 13, 23, (n=2), 1, 2, 3 (n=1)



Oleg Komarov on 27 May 2012

doc nchoosek

S. David on 28 May 2012

I did not know it is built-in in MATLAB. Thanks

S. David


No products are associated with this question.

1 Answer

Answer by Junaid on 27 May 2012

Take a look over this link. This might be useful for you.

1 Comment

S. David on 28 May 2012

It is not working. I do not know why. I think choosek does the job. Thanks anyway


Contact us