How to change block order between MatLab Sessions (Psychtoolbox)

조회 수: 1 (최근 30일)
Brittany Woodruff
Brittany Woodruff 2019년 12월 5일
답변: Walter Roberson 2019년 12월 5일
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!

답변 (1개)

Walter Roberson
Walter Roberson 2019년 12월 5일
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.

카테고리

Help CenterFile Exchange에서 Image display and manipulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by