필터 지우기
필터 지우기

strings pseudo-randomization plus constraints

조회 수: 3 (최근 30일)
Ubu
Ubu 2012년 5월 15일
Dear all,
I'm about to randomize my stimuli for an experiment. Each stimulus corresponds to an audio-file, whose name might be like the following:
ALPHA_BETA_AA_01 or
ALPHA_BETA_BB_01 or
ALPHA_BETA_CC_01 or ...
ALPHA_BETA_CC_48
I have six conditions with 48 stimuli each, plus six conditions with 12 stimuli each.
My goal is to randomize my conditions.
I use to import my list of 360 strings with textread, so that I have
M <360x1 cell>
I'm looking for a way to randomize my stimuli so that no more that three stimuli of the same condition would appear in succession.
As a clarification, the labelling I'm using for my files (i.e. ALPHA_BETA_AA_1) stands for:
ALPHA_BETA %is the name of the file
_AA %is the name of the condition
_01 %is the ordering number
Any suggestion is highly appreciated!
Sincerely,
Udiubu
P.S. I found the "shake" function by Jos van der Geest on the File Exchange, but still, I don't know how to constrain my script.
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 5월 15일
Are the six conditions with the 48 stimuli named differently than the 6 with the 12 stimuli? If not then do the ones that are named the same between the two groups to be considered the same or different?
Ubu
Ubu 2012년 5월 15일
Hi Walter,
Thanks for your answer.
Actually, the email before was silghtly misleading.
I can easily rename my files, so that they can look this way:
Condition AA would be:
AA_01_ALPHA_BETA
AA_02_DELTA_GAMMA
AA_48_PSI_OMEGA
Condition BB would be
BB_01_AAAA_BBBB
BB_02_DDD_GGGG
BB_48_PPP_OMEGA
Condition ZZ (with 12 stimuli) would be:
ZZ_01_XXX_SSS
ZZ_02_LLL_GGGG
ZZ_12_AAQ_QQQQ
For all conditions - those with 12 stimuli included - the first two letters idicate the conditions, the number is the ordering, the two strings are different for each stimulus for each condition.
I hope this help, Walter!

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 15일
codes = [101:148,201:212];
need_valid = true;
while need_valid
randcodes = codes(randperm(length(codes)));
need_valid = ~isempty(strfind(floor(randcodes ./ 100), [0 0]));
end
At this point, randcodes encodes the ordering, with the hundreds digit of each location indicating which of the two conditions it is, and with the last two digits indicating the stimuli within the condition.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by