How to change block order between MatLab Sessions (Psychtoolbox)

1 vue (au cours des 30 derniers jours)
Brittany Woodruff
Brittany Woodruff le 5 Déc 2019
I have a code which is meant to shuffle a block order in psychtool box, written:
s_block = Shuffle(obj.block);
for i = 1:length(s_block)
Which will change the order between runs if the code is run consecutive times. However, whenever I close the program and reopen it it, it goes back to the first run's order. I have tried randomsample(obj.block,n) where n can be any interger from 1 to 8 and it will still produce the same order, but if i go over 8 it will freeze (there are 8 blocks presented). The only code I've had even partial luck with is:
s_block = randperm(obj.block)
Which generates a new order, but has the same issue (if i close the program and reopen it, it goes back to this new order)
I've also tried
s_block = randperm(obj.block,n)
And it still goes back to this second order.
Any suggestions would be helpful on how I can resolve this. Thanks!

Réponses (1)

Walter Roberson
Walter Roberson le 5 Déc 2019
rng('shuffle') seeds the random number generator based on the current
time so that RAND, RANDI, and RANDN produce a different sequence of
numbers after each time you call rng.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by