Mworks selection object not reset

Rishi Rajalingham's Avatar

Rishi Rajalingham

02 Dec, 2019 04:57 PM

Hi Chris,
Just wanted to let you know that I’ve observed that a selection variable where the autoreset field is set to YES does not automatically reset when the selections are all made. Instead it seems to sample the same last value a bunch of times (probably exactly the same as the number of entries in the selection variable) before resetting. This seems either wrong or counter-intuitive. Do you have any suggestions?
Thanks,
Rishi

  1. Support Staff 1 Posted by Christopher Sta... on 02 Dec, 2019 04:59 PM

    Christopher Stawarz's Avatar

    Hi Rishi,

    Can you send me an example experiment that demonstrates this behavior?

    Thanks,
    Chris

  2. 2 Posted by Rishi Rajalingh... on 02 Dec, 2019 05:03 PM

    Rishi Rajalingham's Avatar

    At the moment, I am explicitly calling "reset_selections" when I expect the
    selection variable to be expired.

  3. Support Staff 3 Posted by Christopher Sta... on 02 Dec, 2019 06:30 PM

    Christopher Stawarz's Avatar

    Can you at least send me the definition of the selection variable that isn't auto-resetting? In my tests, autoreset is working as expected, so I'm trying to understand what's different in your experiment.

    Thanks,
    Chris

  4. 4 Posted by Rishi Rajalingh... on 02 Dec, 2019 09:31 PM

    Rishi Rajalingham's Avatar

    Yes, it's in the file I attached above... Pasted here as well

    selection trial_index (
        values = 0:199
        selection = random_with_replacement
        advance_on_accept = YES
        autoreset = YES
        )

  5. Support Staff 5 Posted by Christopher Sta... on 03 Dec, 2019 05:37 PM

    Christopher Stawarz's Avatar

    Sorry, I didn't get the attached file. (MWEL files seems to get caught in spam filters, probably due to the unknown extension. You can avoid this by appending .txt to the filename or zip-compressing the file.)

    Anyway, the problem is that advance_on_accept and autoreset don't work together. A selection variable with advance_on_accept set to YES will automatically advance only when there are unused selections remaining. If there are no selections left, then it won't attempt to advance, and the variable will never get the chance to automatically reset itself.

    Addressing this issue is on my to-do list. In the meantime, you can work around it by omitting advance_on_accept and manually calling next_selection after accepting.

    Cheers,
    Chris

  6. 6 Posted by Rishi Rajalingh... on 03 Dec, 2019 05:40 PM

    Rishi Rajalingham's Avatar

    Got it -- thanks, Chris!

  7. Christopher Stawarz closed this discussion on 03 Dec, 2019 07:13 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