N_PERMUTE_K
by Matt Fig
19 Jun 2006
(Updated 11 May 2009)
All possible permutations of the elements of set N, taken K at a time, with repetition.
|
Watch this File
|
| File Information |
| Description |
MAT = NPERMUTEK(N,K) returns all possible permutations of the elements taken from vector N of length K. This type of sampling is an ordered sample with replacement.
This is also known as the permutations with repetition.
MAT has size (length(N)^K)-by-K, where K must be a scalar.
[MAT, IDX] = NPERMUTEK(N,K) also returns IDX such that MAT = N(IDX).
If N is of class single, MAT and IDX will be also.
Please email me about bugs in the code.
Thanks |
| Acknowledgements |
The author wishes to acknowledge the following in the creation of this submission:
COMBN (4.2)
This submission has inspired the following:
VChooseKRO
|
| 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.
|
| Updates |
| 19 Jun 2006 |
Error in help. |
| 20 Jun 2006 |
Faster, due to remedying obvious omission of preallocation! |
| 02 Oct 2008 |
Added a picture of output. |
| 10 Oct 2008 |
Added keyword. |
| 13 Oct 2008 |
Uploaded the wrong file. |
| 07 May 2009 |
Cut execution time in half for single output calls. Added full support for single class. |
| 11 May 2009 |
Fixed typos (Matlab needs spellchecker for guys like me.) |
|
Contact us at files@mathworks.com