File Exchange

image thumbnail

permnsub(V,N, IX)

version 9.9 (2.99 KB) by

Subset of all permutations with repetition



View License

Its functionality is now implemented in my function PERMN, available on the File Exchange
permnsub - subset of all permutations with repetition
M = permnsub(V,N,IX) returns a subset of all permutations, with
repetition, of N elements, taken from the elements in vector V. M has
the size numel(IX)-by-N. V can be an array of numbers, cells or strings,
and M will be of the same type as V.

Use PERMN instead

Comments and Ratings (1)

Jan Simon

Jan Simon (view profile)

This is an excellent implementation of a very efficient method. Together with the exhaustive documentation this submission is useful, usable and valuable for the productive work and education. Thanks, Jos!

A tiny simplification: You do not need B(:)', because B is a row vector already.



obsolete. Use PERMN


included correct file


renamed submission, extended help section


1.1 - implemented suggestion of Jan; output is now always a row vector

MATLAB Release
MATLAB 7.14 (R2012a)

Inspired by: permn(V, N, K)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today