Failing randomization through closing matlab
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I am coding an experiment but I ran into a problem regarding the presentation of random stimuli. The experiment includes a trial list which is mostly created using the randi() function. However, everytime I close Matlab and script, the numbers will exactly the same in the next session. This does not happen if a simply leave the matlab window open and rerun the code.
Any ideas concerning the root of this problem?
Thank you in advance!
Best,
Kathrin
0 个评论
回答(1 个)
Ameer Hamza
2020-12-4
编辑:Ameer Hamza
2020-12-4
Read here: https://www.mathworks.com/help/matlab/math/why-do-random-numbers-repeat-after-startup.html . You can avoid the repetition by running
rng('shuffle');
at startup.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!