Code covered by the BSD License  

Highlights from
Next Combination/Permutation

Be the first to rate this file! 20 Downloads (last 30 days) File Size: 7.53 KB File ID: #24459
image thumbnail

Next Combination/Permutation

by Matt Fig

 

17 Jun 2009

Produces one comb/perm at a time. Both with/without repetition.

| Watch this File

File Information
Description

The folder contains 4 files:

NEXTCHOOSE
NEXTMULTICHOOSE
NEXTPERM
NEXTSTRING

which correspond to the combinatorical problems:

Combinations without repetition.
Combinations with repetition.
Permutations without repetition.
Permutations with repetition.

Each of these will produce successive outputs of the combs/perms of K elements taken from the set 1:N.
See the screenshot for an example.

Please read the help before using.
Please email me if bugs are found, or improvements are found.

See also: COMBINATOR (file 24325)
Thanks.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
25 Aug 2011 mklcst mklcst

sorry there was a useless for. I use this

function [vector] = combine(n,k)
tc = factorial(n)/(factorial(k)*factorial(n-k));
vector = zeros(tc,k);
C = nextchoose(n,k);
for i=1:tc
        vector(i,[1:k]) = C();
end

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
combinations Matt Fig 17 Jun 2009 11:45:17
permutations Matt Fig 17 Jun 2009 11:45:17
combinatorics Matt Fig 17 Jun 2009 11:45:17
choose Matt Fig 17 Jun 2009 11:45:17
multichoose Matt Fig 17 Jun 2009 11:45:17
perms Matt Fig 17 Jun 2009 11:45:17
nchoosek Matt Fig 17 Jun 2009 11:45:17

Contact us at files@mathworks.com