How to find all permutations (with repetition) in MATLAB?
Simplifying Amro’s answer, you could use this: %// Sample data x = ‘ABCD’; %// Set of possible letters K = 3; %// Length of each permutation %// Create all possible permutations (with repetition) of letters stored in x C = cell(K, 1); %// Preallocate a cell array [C{:}] = ndgrid(x); %// Create K grids of … Read more