how to generate a pattern

2 次查看(过去 30 天)
Duncan
Duncan 2014-8-23
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?

回答(1 个)

Star Strider
Star Strider 2014-8-23
If you have the Statistics Toolbox, use the combnk function. Otherwise, use Matt Fig’s File Exchange contribution combinator.

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by