how to generate a pattern

I would like to generate all the possible combinations
for example:
[1 2 3 4 5]
I want to generate a reordered version of the original:
[2 3 4 5 1;
3 4 5 1 2;
4 5 1 2 3;
5 1 2 3 4]
how should i do that?

Réponses (1)

Star Strider
Star Strider le 23 Août 2014

1 vote

If you have the Statistics Toolbox, use the combnk function. Otherwise, use Matt Fig’s File Exchange contribution combinator.

Catégories

En savoir plus sur Random Number Generation dans Centre d'aide et File Exchange

Produits

Question posée :

le 23 Août 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by