Variable groups

Hi Chris,

I would like to request a potentially major, but extremely important improvement to MWorks. I have found that accessing and modifying variables in a complex paradigms (with numerous variables) is not feasible except for the person who has written the program, or unless one takes the time to search through all the variables. This is generally not a problem for a finalized paradigm and a well trained monkey, but for intermediate stages where we need to adjust variables constantly to help expedite the animal’s learning, this issue is presenting itself as a major obstacle. We have already stumbled on this problem twice trying to make a new user take advantage of a program of another user.

One way to make a huge improvement on this is to have the variables conceptualized and displayed as groups. For example to create “variable groups” with a particular label (e.g., “Fixation spot variables”) allowing the user to create new variables associated with a particular stimulus or function under the appropriate group. Additionally, when showing the variables, it would be extremely useful to be able to show the groups instead of individual variables and allowing the user to open a specific group (i.e., a list inside another list) to monitor and modify the relevant variables. It’s possible to have a default “base group” for all variables that are not associated with a group. In that way, users could enhance existing programs by creating new groups and moving variables to them. Also it would help users write their new programs with the availability of this feature in mind.

This is a fairly important feature for our use with high priority, if at all possible. Please let me know if you need any clarification for what I am suggesting.

Please let me know what you think.

Thanks,
-Mehrdad

Hi Mehrdad,

This feature already exists, but it’s also nearly impossible to discover. My apologies for the trouble this has caused you.

To place a variable in one or more groups, you include a groups attribute in its definition. (Unhelpfully, this is not included in the default variable template in the editor. More on that below.) This attribute should be a comma-separated list of group names. For example:

<variable tag="dog" groups="Mammal, Pet" scope="global" logging="when_changed" default_value="Rover" type="any"></variable>

MWClient’s variables window displays variable groups as expandable lists. To demonstrate, I’ve attached an experiment that defines six variables divided into three groups. I’ve also attached a view of the variables window, which shows all three groups expanded. You’ll notice three additional groups, which are created automatically: “# EXPERIMENT VARIABLES” contains all user-defined variables, “# SYSTEM VARIABLES” contains all system-defined variables, and “# ALL VARIABLES” contains everything.

The expansion state of all variable groups (both automatically created and user defined) is saved and restored between client sessions. You can also set the expanded groups in a workspace file.

I mentioned previously that when you create a new variable in MWEditor, there isn’t a spot to set the variable’s group(s), meaning you have to add the groups attribute manually. However, the editor does support folders of items, which can be used to group variables together. At present, placing a variable in a folder has no effect on the groups it’s in, but changing this in on my to-do list for the next MWorks release. In the future, placing a variable in a named folder will cause it to be associated with a group of the same name automatically. This should mostly eliminate the need to set a variable’s groups attribute at all (the exception being cases where you want a variable in more than one group).

I believe the existing variable groups implementation provides all the features you requested. However, if there is additional functionality that you require, or you need more information on anything, please let me know.

Cheers,
Chris

Attachments:

That terrific! I wish I had asked earlier! Please let us know when the new feature (as a folder option) is integrated in the new release.

Best,
-Mehrdad

Hi Mehrdad,

Please let us know when the new feature (as a folder option) is integrated in the new release.

This is done and in the MWorks nightly build. I’ve attached a new example experiment that demonstrates how to use folders to create the same variable groupings as before (but without the groups attribute).

Cheers,
Chris

Attachment: folder_demo.xml (1.47 KB)

Thank you Chris! That sounds great.

-Mehrdad