N_PERMUTE_K

版本 1.4.0.0 (2.5 KB) 作者: Matt Fig
All possible permutations of the elements of set N, taken K at a time, with repetition.
10.6K 次下载
更新时间 2012/8/31

查看许可证

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

引用格式

Matt Fig (2024). N_PERMUTE_K (https://www.mathworks.com/matlabcentral/fileexchange/11462-n_permute_k), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2007a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Elementary Math 的更多信息
致谢

参考作品: permn

启发作品: VChooseKRO, n permute k

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.4.0.0

MathWorks changed the behavior of the DIFF function with character arrays, resulting in an error for this file when called as in the second help example.

1.2.0.0

Fixed typos (Matlab needs spellchecker for guys like me.)

1.1.0.0

Cut execution time in half for single output calls. Added full support for single class.

1.0.0.0

Uploaded the wrong file.