special case of permutation combination with same sequence

1 回表示 (過去 30 日間)
Vishal Sharma
Vishal Sharma 2017 年 1 月 30 日
回答済み: Guillaume 2017 年 1 月 30 日
I have a problem of special case of permutation combination From nos from 1 to 30 .
Supposing a permutation combination from vector 1 to 30 is to be formulated Condition is sequence of previous solution should remain same
Supposing we have reached at 3rd step Where we have 4 5 6 numbers selected and we have to select forth number from remaining set numbers, i.e. from 1 – 3 and 7 – 30, so permutation combinations should be such that sequence of previous numbers 4 5 6 should remain same, so the result should be
1 4 5 6
2 4 5 6
3 4 5 6
7 4 5 6
4 1 5 6
......
and so on When we have four digit selected say (e.g.) 4 9 5 6 Next time permutation combinations are to be formulated for fifth digit from remaining set of numbers in the same sequence of 4 9 5 6
Thanks and Regards
  2 件のコメント
Stephen23
Stephen23 2017 年 1 月 30 日
@Vishal Sharma: What exactly is your question? Or are you just looking for someone to do your homework for you? You do not seem to have put any effort into this at all.
Adam
Adam 2017 年 1 月 30 日
You need to give a clearer full example of what you are aiming for. I don't see any obvious logic behind the 'result' that you say should happen, other than that initially it just has 4 5 6 repeated after each number until some point and then it just appears arbitrary.
Permutations and combinations are two distinct things though so saying permutation combinations is confusing.

サインインしてコメントする。

回答 (1 件)

Guillaume
Guillaume 2017 年 1 月 30 日
What you want is not clear. Possibly, it is this:
fullset = 1:30;
currentset = [4 5 6];
setperms = arrayfun(@(n) perms([n, currentset]), setdiff(fullset, currentset), 'UniformOutput', false);
setperms = vertcat(setperms{:})

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by