Strings & Permutation: Permute strings

Generate a new Strings with a strings ordering determined by the Permutation.

The number of strings in the Strings and the number of elements in the Permutation have to be equal.


1. If the selected Strings has the 4 strings ordered as "heed", "hid", "hood", "hud", and the permutation is (4,3,2,1), the new Strings has the ordering "hud", "hood", "hid", "heed".

2. In the example that is discussed in the listening experiment section, we have four stimuli "heed.wav", "hid.wav", "hood.wav", "hud.wav" that we want to present three times to each subject with a <PermuteBalancedNoDoublets> randomization strategy, i.e. stimuli presented in blocks of four, randomized, and no two successive stimuli equal. This type of randomization can easily be accomplished with a Permutation object and a Strings.

1. Fill the Strings object with 12 strings, i.e. three repetitions of the four stimuli.
2. Create a Permutation object with 12 elements and perform Permute randomly (blocks): 0, 0, 4, "yes", "yes". We randomly permute blocks of size 4 and permute randomly within these blocks and make sure that on the transition from on block to the other no two stimuli are equal. (Of course, the random permutation of the blocks makes no difference here since all the blocks have the same content.)
3. Select the Strings and the Permutation together and choose Permute strings. Now the new Strings will contain the new ordering of the stimuli.

Links to this page

© djmw, January 30, 2014