n permute k
                    Version 1.1.0.0 (2.36 KB) by  
                  Eydrian
                
                
                  Based on Matt Fig's npermutek this function returns all possible permutations of most matlab classes
                
                  
              Permutation of elements with replacement/repetition. MAT = npermutek(N,K) returns all possible samplings of length K from vector N of type: ordered sample with replacement. MAT has size (numel(N)^K)-by-K, where K must be a scalar. [MAT, IDX] = npermutek(N,K) also returns IDX such that MAT = N(IDX).
  N may be of any numeric class, char, cell, struct, or even obj.  
Cite As
Eydrian (2025). n permute k (https://uk.mathworks.com/matlabcentral/fileexchange/40546-n-permute-k), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
              Created with
              R2012b
            
            
              Compatible with any release
            
          Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Mathematics > Elementary Math >
 
      Find more on Elementary Math in Help Center and MATLAB Answers
    
  Tags
Acknowledgements
Inspired by: N_PERMUTE_K
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.