selection variables

Mark Histed's Avatar

Mark Histed

18 Apr, 2013 01:37 PM

Hi Chris,

As I understand it, now in MWorks 0.5, expressions can be use to specify the parameters of a range replicator.

Can something similar be done with selection variables? In particular, I'd like to do something like

<variable tag="nConditions" scope="global" logging="when_changed" default_value="5" type="integer" persistant="1"/>
<variable type="selection" tag="svStimNumber" values="0:$nConditions-1" nsamples="$nConditions" sampling_method="samples"/>

Is this possible or are only literals accepted in selection variable parameters?

Thanks, best,
Mark

  1. Support Staff 1 Posted by Christopher Sta... on 18 Apr, 2013 02:28 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    In MWorks 0.5, you can do almost exactly what you want to do. The only exception is that the "nsamples" parameter must be a literal value, not an expression. However, in this case, you can work around that limitation by changing "sampling_method" to "cycles" and setting "nsamples" to 1. See the attached example.

    Cheers,
    Chris

  2. 2 Posted by Mark Histed on 18 Apr, 2013 03:38 PM

    Mark Histed's Avatar

    Chris,

    Thanks for the quick and complete response, as usual.

    Just to verify that I understand:
    I want the selection variable to allow me to choose values at random without replacement. I think you once said that when sampling_method is "cycles", nsamples="1" will do this (go through the list of values exactly once). Correct?

    Also, I'm sorry for being a little dense about range replicators, I'm not 100% sure what they do. If I understand correctly here, the range replicator is not required, I can remove it and draw one sample each trial and the selection variable will still return draws at random without replacement from the full list. Is this also correct?

    best!
    Mark

  3. Support Staff 3 Posted by Christopher Sta... on 18 Apr, 2013 04:24 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    I want the selection variable to allow me to choose values at random without replacement. I think you once said that when sampling_method is "cycles", nsamples="1" will do this (go through the list of values exactly once). Correct?

    Correct. That's exactly what my example experiment does.

    If I understand correctly here, the range replicator is not required, I can remove it and draw one sample each trial and the selection variable will still return draws at random without replacement from the full list. Is this also correct?

    That's right. You can use a selection variable without a range replicator.

    Chris

  4. 4 Posted by Mark Histed on 18 Apr, 2013 06:26 PM

    Mark Histed's Avatar

    Great - thank you!
    Mark

  5. Christopher Stawarz closed this discussion on 18 Apr, 2013 06:57 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac