PARTPERM -- Partial random permutation of a vector
by David Fass
04 Aug 2004
(Updated 03 Sep 2004)
Partial random permutation of a vector.
|
Watch this File
|
| File Information |
| Description |
X = PARTPERM(A,IDX) randomly permutes the elements of vector A which are specified by vector IDX. That is, the elements A(IDX) are randomly interchanged with one another and the resulting (partially permuted) vector is returned. No permutation occurs when length(IDX) < 2.
By default, permutation is subject to the constraint that all elements specifed by IDX must appear in new positions ("derangement"). If you don't like this, use the following syntax:
X = PARTPERM(A,IDX,'allow') randomly permutes the elements of vector A which are specified by vector IDX, but allows indexed elements to remain unchanged if that is the natural result of the random permutation (i.e., if after permutation an element's new location happens to be the same as its original location). |
| Acknowledgements |
This submission has inspired the following:
Permute a grouped vector
|
| 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 (1) |
| 13 Sep 2006 |
Gil Abramovich
|
|
|
| Updates |
| 03 Sep 2004 |
Improved the help text. |
|
Contact us at files@mathworks.com