<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/279841</link>
    <title>MATLAB Central Newsreader - generating a pseudorandom order of trials</title>
    <description>Feed for thread: generating a pseudorandom order of trials</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.nl/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 19 Apr 2010 15:10:27 +0000</pubDate>
      <title>generating a pseudorandom order of trials</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/279841#737426</link>
      <author>Renee </author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
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.  &lt;br&gt;
&lt;br&gt;
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?&lt;br&gt;
&lt;br&gt;
Thanks.</description>
    </item>
    <item>
      <pubDate>Mon, 19 Apr 2010 15:29:22 +0000</pubDate>
      <title>Re: generating a pseudorandom order of trials</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/279841#737435</link>
      <author>Rune Allnor</author>
      <description>On 19 apr, 17:10, "Renee " &amp;lt;rshim...@csu.fullerton.edu&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 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.  &lt;br&gt;
&lt;br&gt;
So you want 64 trials containing 8 classes of elements,&lt;br&gt;
each of which can not appear more than 8 times. Can any&lt;br&gt;
one trial contain duplicat classes, or do you require&lt;br&gt;
all trials to contain 8 unique item classes?&lt;br&gt;
&lt;br&gt;
If the latter, this is not random but an 8-by-8 sudoku&lt;br&gt;
board.&lt;br&gt;
&lt;br&gt;
Rune</description>
    </item>
    <item>
      <pubDate>Mon, 19 Apr 2010 16:49:18 +0000</pubDate>
      <title>Re: generating a pseudorandom order of trials</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/279841#737461</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
"Rune Allnor" &amp;lt;allnor@tele.ntnu.no&amp;gt; wrote in message &lt;br&gt;
news:040b3406-6882-4d7b-89e7-2e41a60dc768@y14g2000yqm.googlegroups.com...&lt;br&gt;
&amp;gt; On 19 apr, 17:10, "Renee " &amp;lt;rshim...@csu.fullerton.edu&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I'm trying to write a program with 64 trials. Within those 64 trials, 8 &lt;br&gt;
&amp;gt; &amp;gt; different items must be presented 8 different times; however, I need &lt;br&gt;
&amp;gt; &amp;gt; them to appear in random order but not more than 8 times.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So you want 64 trials containing 8 classes of elements,&lt;br&gt;
&amp;gt; each of which can not appear more than 8 times. Can any&lt;br&gt;
&amp;gt; one trial contain duplicat classes, or do you require&lt;br&gt;
&amp;gt; all trials to contain 8 unique item classes?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; If the latter, this is not random but an 8-by-8 sudoku&lt;br&gt;
&amp;gt; board.&lt;br&gt;
&lt;br&gt;
Actually, Sudoku usually adds the restriction that a submatrix also must &lt;br&gt;
contain only one instance of each number.  But for a smaller case, 16 trials &lt;br&gt;
with 4 different items, I believe this would be a solution to the OP's &lt;br&gt;
scenario but would not be a Sudoku solution:&lt;br&gt;
&lt;br&gt;
[1 2 3 4; 4 1 2 3; 3 4 1 2; 2 3 4 1]&lt;br&gt;
&lt;br&gt;
What the OP described sounds more like a Latin square:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://en.wikipedia.org/wiki/Latin_square"&gt;http://en.wikipedia.org/wiki/Latin_square&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com&lt;br&gt;
comp.soft-sys.matlab (CSSM) FAQ: &lt;a href="http://matlabwiki.mathworks.com/MATLAB_FAQ"&gt;http://matlabwiki.mathworks.com/MATLAB_FAQ&lt;/a&gt; </description>
    </item>
    <item>
      <pubDate>Mon, 19 Apr 2010 16:53:26 +0000</pubDate>
      <title>Re: generating a pseudorandom order of trials</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/279841#737464</link>
      <author>Walter Roberson</author>
      <description>Steven Lord wrote:&lt;br&gt;
&amp;gt; "Rune Allnor" &amp;lt;allnor@tele.ntnu.no&amp;gt; wrote in message &lt;br&gt;
&amp;gt; news:040b3406-6882-4d7b-89e7-2e41a60dc768@y14g2000yqm.googlegroups.com...&lt;br&gt;
&amp;gt;&amp;gt; On 19 apr, 17:10, "Renee " &amp;lt;rshim...@csu.fullerton.edu&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I'm trying to write a program with 64 trials. Within those 64 trials, 8 &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; different items must be presented 8 different times; however, I need &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; them to appear in random order but not more than 8 times.&lt;br&gt;
&lt;br&gt;
&amp;gt; What the OP described sounds more like a Latin square:&lt;br&gt;
&lt;br&gt;
A Latin Square has the final line fully constrained by the lines above &lt;br&gt;
it, and thus could not satisfy the original requirements that the order &lt;br&gt;
be _random_ .&lt;br&gt;
&lt;br&gt;
items(randperm(8)) done 8 times would satisfy the original criteria.</description>
    </item>
    <item>
      <pubDate>Mon, 19 Apr 2010 18:41:22 +0000</pubDate>
      <title>Re: generating a pseudorandom order of trials</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/279841#737504</link>
      <author>Roger Stafford</author>
      <description>"Renee " &amp;lt;rshimizu@csu.fullerton.edu&amp;gt; wrote in message &amp;lt;hqhrp3$r0l$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 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.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 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?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks.&lt;br&gt;
----------------------&lt;br&gt;
&amp;nbsp;&amp;nbsp;This ought to do the job:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;p = repmat(1:8,1,8); % Each of 1:8 eight times&lt;br&gt;
&amp;nbsp;p = p(randperm(8*8)); % Rearrange in random order&lt;br&gt;
&lt;br&gt;
The vector p contains each of the numbers 1 to 8 eight different times but rearranged to be random order.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
  </channel>
</rss>
