Mworks Monkey name

Hi Chris,

I’m wondering if it’s possible to add a field to an mworks experiment file for recording the name of the monkey that is running. We want to use that field to name the .mwk2 files instead of naming the files after the user (ex. pico-normalizers-20220615-113241.mwk2 instead of datamaco-normalizers-20220615-113241.mwk2). Is this something we could get your help with?

Thank you,
Sarah

Hi Sarah,

Sure. The best way to do this is by adding a data file device to your experiment.

First, create a variable with the monkey’s name:

var animal_name = 'pico'

Then, use that variable in the filename parameter of the data file:

data_file ("${animal_name}-normalizers-$(date('%Y%m%d-%H%M%S'))")

If you’re using the same protocol with multiple animals, then you could declare the variable and data file in the same MWEL file as the protocol:

var animal_name = 'UNKNOWN'
data_file ("${animal_name}-...")

and then have a separate file for each animal that includes the protocol and assigns the correct name:

%include 'shared_protocol.mwel'
animal_name = 'pico'

For a bit more info on data file devices, see this post. If you have any questions, please let me know.

Cheers,
Chris

Thanks Chris! Will try this and get back to you if I’m failing.

Hi Chris,

I tried this on one of our rigs, but I’m thinking our mworks version is too outdated to have data file devices? We have version 0.9 and I keep getting the error message “data_file is not a valid component type signature”.

Hi Sarah,

Yes, data file devices were added in MWorks 0.10. You’ll need to upgrade to a more recent release to use them.

Cheers,
Chris

Thanks Chris, thought this may be the case. I will get back to you once we eventually do all the upgrades in Rig 1!