From: Renee on 19 Apr 2010 11:10 Hi, I'm trying to write a program with 64 trials. Within those 64 trials, 8 different items must be presented 8 different times; however, I need them to appear in random order but not more than 8 times. What I was trying to do was generate the order of trials based on rand() but that doesn't guarantee exactly 8 trials of each stimulus. Is there a way I can specify a limit on how often something is presented? Thanks.
From: Rune Allnor on 19 Apr 2010 11:29 On 19 apr, 17:10, "Renee " <rshim...(a)csu.fullerton.edu> wrote: > Hi, > > I'm trying to write a program with 64 trials. Within those 64 trials, 8 different items must be presented 8 different times; however, I need them to appear in random order but not more than 8 times. So you want 64 trials containing 8 classes of elements, each of which can not appear more than 8 times. Can any one trial contain duplicat classes, or do you require all trials to contain 8 unique item classes? If the latter, this is not random but an 8-by-8 sudoku board. Rune
From: Steven Lord on 19 Apr 2010 12:49 "Rune Allnor" <allnor(a)tele.ntnu.no> wrote in message news:040b3406-6882-4d7b-89e7-2e41a60dc768(a)y14g2000yqm.googlegroups.com... > On 19 apr, 17:10, "Renee " <rshim...(a)csu.fullerton.edu> wrote: > > Hi, > > > > I'm trying to write a program with 64 trials. Within those 64 trials, 8 > > different items must be presented 8 different times; however, I need > > them to appear in random order but not more than 8 times. > > So you want 64 trials containing 8 classes of elements, > each of which can not appear more than 8 times. Can any > one trial contain duplicat classes, or do you require > all trials to contain 8 unique item classes? > > If the latter, this is not random but an 8-by-8 sudoku > board. Actually, Sudoku usually adds the restriction that a submatrix also must contain only one instance of each number. But for a smaller case, 16 trials with 4 different items, I believe this would be a solution to the OP's scenario but would not be a Sudoku solution: [1 2 3 4; 4 1 2 3; 3 4 1 2; 2 3 4 1] What the OP described sounds more like a Latin square: http://en.wikipedia.org/wiki/Latin_square -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: Walter Roberson on 19 Apr 2010 12:53 Steven Lord wrote: > "Rune Allnor" <allnor(a)tele.ntnu.no> wrote in message > news:040b3406-6882-4d7b-89e7-2e41a60dc768(a)y14g2000yqm.googlegroups.com... >> On 19 apr, 17:10, "Renee " <rshim...(a)csu.fullerton.edu> wrote: >>> I'm trying to write a program with 64 trials. Within those 64 trials, 8 >>> different items must be presented 8 different times; however, I need >>> them to appear in random order but not more than 8 times. > What the OP described sounds more like a Latin square: A Latin Square has the final line fully constrained by the lines above it, and thus could not satisfy the original requirements that the order be _random_ . items(randperm(8)) done 8 times would satisfy the original criteria.
From: Roger Stafford on 19 Apr 2010 14:41 "Renee " <rshimizu(a)csu.fullerton.edu> wrote in message <hqhrp3$r0l$1(a)fred.mathworks.com>... > Hi, > > I'm trying to write a program with 64 trials. Within those 64 trials, 8 different items must be presented 8 different times; however, I need them to appear in random order but not more than 8 times. > > What I was trying to do was generate the order of trials based on rand() but that doesn't guarantee exactly 8 trials of each stimulus. Is there a way I can specify a limit on how often something is presented? > > Thanks. ---------------------- This ought to do the job: p = repmat(1:8,1,8); % Each of 1:8 eight times p = p(randperm(8*8)); % Rearrange in random order The vector p contains each of the numbers 1 to 8 eight different times but rearranged to be random order. Roger Stafford
|
Pages: 1 Prev: Context Sensitive Help with a Ui Tab group Next: integrate function with two variables |