Millisecond Forums

Dynamic numbers of trials / Conditional trialnumber

https://forums.millisecond.com/Topic7991.aspx

By jmwotw - 5/2/2012

Hi all.  Is it possible to conditionally specify the number of trials in a block element?  I've tried a couple of different approaches (below), but I keep getting an 'invalid syntax' error.  More details attached.




<block K_Prac_block>



/ trials = [1 - values.LETTER_item_num = noreplace(LETTER_Prac_trials)]


   </block>



I've also tried this (both with and without quotes):



<block K_Prac_block>


/ trials = [1 - "<%values.LETTER_item_num%>" = noreplace(LETTER_Prac_trials)]


</block>




Thanks,


Jeff

By Dave - 5/2/2012

Syntax like the one above is not permitted. You need to implement this differently, e.g. using a /stop attribute.


<values>
/ ntrials = 40
</values>

<block myblock>
/ stop = [block.myblock.trialcount>values.ntrials]
/ trials = [1-10000=mytrial]
</block>


Regards,


~Dave

By jmwotw - 5/2/2012

Thanks, Dave.  That did the trick.  To clarify for those who find this later, the stop attribute executes after the block has run so if the ntrials variable equals the maximum, then the stop function should be 


/ stop = [block.myblock.trialcount >values.ntrials]


Jeff