|
|
| File Information |
| Description |
PERMPOS - all possible permutations of M values in N positions
B = PERMPOS(M,N) where M and N are non-negative integers produces a
logical (N!/M!(N-M)!)-by-N matrix in which each row contains a unique
permation of M trues and (N-M) falses. Note that each column will hence
contain (N-1) trues.
B = PERMPOS(V,N) where V is a vector of length M produces a matrix
where each row a contains the values of V in preserved order, but
uniquely permuted at the N columns. The remaining positions are zero.
Examples:
permpos(2,4) % ->
% 1 1 0 0
% 1 0 1 0
% 1 0 0 1
% 0 1 1 0
% 0 1 0 1
% 0 0 1 1
permpos([-4 9 3],4) % >
% -4 9 3 0
% -4 9 0 3
% -4 0 9 3
% 0 -4 9 3
See also NCHOOSEK, PERMS, RANDPERM, TRUE, FALSE
and COMBN, ALLCOMB, BALLATSQ, NONES (Matlab File Exchange)
Version 2.1 (march 2007) |
| MATLAB release |
MATLAB 6.5 (R13)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (10) |
| 04 Mar 2007 |
Dimitri Shvorob
|
|
|
| 05 Mar 2007 |
Jos (the author)
|
|
|
| 14 Jun 2007 |
brad mcevoy
|
|
|
| 28 Mar 2008 |
Berta Neto
|
|
|
| 15 Apr 2008 |
ahmad ababnah
|
|
|
| 27 Oct 2008 |
Amanda
|
|
|
| 27 Oct 2008 |
Jos (10584)
|
|
|
| 19 Feb 2009 |
Anders
|
|
|
| 03 Mar 2010 |
Richard Crozier
|
|
|
| 15 Oct 2010 |
Nima Moshtagh
|
|
|
| Updates |
| 06 Mar 2007 |
remove unnecessary check for input size (after review by Dmitri S.) |
|
Contact us at files@mathworks.com