Converting experiment to MWEL

mhisted's Avatar


28 Nov, 2018 05:21 PM

Hi Chris,

Our seat upgrade still hasn't processed, so here is the important code.

The key XML file is HoldAndDetectConstant/HoldAndDetectConstant8.xml


  1. Support Staff 1 Posted by Christopher Sta... on 28 Nov, 2018 06:16 PM

    Christopher Stawarz's Avatar

    Hi Mark, Anna, & Paul,

    I had a look at the hold-and-detect experiment XML. One thing that immediately seems clear is that it would be crazy (in terms of both the tedium and the likelihood of introducing errors) to try to convert this to MWEL by hand. The rough XML-to-MWEL translator that I wrote for Mark does a decent job with it, but there's certainly room for improvement.

    I think the first step is to improve the automatic XML-to-MWEL translation to produce output that is clean, readable, and as MWEL-ish as possible (and also preserves XML comments, which the current convertor does not). Once that's done, and I have a good automatic translation in hand, I'll think about ways to restructure the experiment to take advantage of MWEL's more sophisticated features (i.e. includes and macros).


  2. 2 Posted by mhisted on 28 Nov, 2018 07:02 PM

    mhisted's Avatar

    That sounds great from my perspective, Chris.

    We want to improve the experiemnt in a few ways (i.e. replacing that huge set of if statements with array accesses), but I think the right thing to do is let you do the auto-convert to MWEL first, then make our changes.

    If you could do this by mid- to end- December or so, that would be great - we're starting to get animals ready for this experiment.


  3. Support Staff 3 Posted by Christopher Sta... on 14 Dec, 2018 03:54 PM

    Christopher Stawarz's Avatar

    Hi Mark et al,

    I've attached the automatic conversion of HoldAndDetectConstant8 to MWEL. Apart from maybe warranting some aesthetic tweaks (e.g. adding some blank lines for readability, moving some comments around), I think it's in pretty good shape. It makes use of a couple recent changes I made to MWEL, so to run it, you'll need the latest MWorks nightly build.

    Also in the current nightly is the tool (aptly called xml2mwel) that did the conversion. To convert other experiments, open up Terminal and invoke xml2mwel like this:

    /Library/Application\ Support/MWorks/MWEL/xml2mwel exp.xml > exp.mwel

    If there are issues with the conversion, the script will print some error messages (although there really isn't much that can go wrong).

    If you see anything that the converter got wrong or have suggestions for how to make it better, please let me know!


  4. Christopher Stawarz closed this discussion on 20 Apr, 2019 04:47 PM.

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

Keyboard shortcuts


? 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

Recent Discussions

17 May, 2022 02:12 PM
16 May, 2022 03:12 PM
04 May, 2022 06:02 PM
03 May, 2022 01:30 PM
02 May, 2022 10:47 PM