0
votes

Hey there, is there any way to 'mix up' the order of the elements of an input vector in matlab randomly? Say I input

[1:5]'

I wanna get out for example:

[3 5 1 2 4]'

thanks!

1

1 Answers

5
votes

Use RANDPERM:

shuffledOutput = inputVector(randperm(length(inputVector)));