No BSD License  

Highlights from
PARTPERM -- Partial random permutation of a vector

5.0

5.0 | 1 rating Rate this file 4 Downloads (last 30 days) File Size: 2.68 KB File ID: #5631

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

Useful and easy. Add examples ot the Description

Please login to add a comment or rating.
Updates
03 Sep 2004

Improved the help text.

Tag Activity for this File
Tag Applied By Date/Time
statistics David Fass 22 Oct 2008 07:29:01
probability David Fass 22 Oct 2008 07:29:01
permute David Fass 22 Oct 2008 07:29:01
permutation David Fass 22 Oct 2008 07:29:01
index David Fass 22 Oct 2008 07:29:01
random David Fass 22 Oct 2008 07:29:01
derangement David Fass 22 Oct 2008 07:29:01

Contact us at files@mathworks.com