MOLE Modifiable Language Experiments

Demo Walkthroughs

Here you will find all the information you need in order to download and run one or more of our demos.  To get started, you should have…

  • MATLAB with PsychToolbox installed on your computer
  • The Demo Materials folder, unzipped
    • Should contain the basic function codes with comments, demo functions, text files, & audiovisual stimuli


Step 1: To download the materials you will need for the demos, go to the “Demo Materials” page on the top navigation bar under this page’s tab.  There should only be 1 zipped file there.  Click on it (or right click and save as) to download it.  Save it to the desktop.  Now, go to the folder and unzip it with the specified program (should already be on your computer).  Make sure you unzip the file to a location you will remember, as you will need to navigate to it in MATLAB in order to run the demos.  This folder should contain everything you need, but check to make sure it has the basic functions with comments (8 of them), demo function scripts, text files, and audiovisual stimuli.

Step 2: You should already have MATLAB with the latest version of PsychToolbox installed.  If this is not the case, please purchase a copy of MATLAB here:, and/or download the free PsychToolbox add-on here:

  • If you already have copies of both of these, it may be of use to you to know which version you are running.  To find this out in MATLAB, open the program and at the command window prompt type “version“.  To find this out in PsychToolbox, at the command window prompt type “PsychtoolboxVersion“.

Step 3: Once you have MATLAB open on your computer, you will need to make sure that MATLAB is looking in the correct directory to run these demos.  To do this, go to the top bar labeled “Current Directory.”  If you know where the file is, you can type in the location, but the simpler way to specify this is to click the “…” button to the right of the directory bar.  This will open a menu where you can navigate to the location that you unzipped the Demo Materials file to.  Once you have found that folder, click on it and press “OK” to select it as your directory.  It is important not to click anything inside the folder, as you don’t want to specify a subfolder as your directory – it won’t have all the components in it!

Step 4: You should now be ready to run one of the demos.  All you have to do at this point is type the name of the demo at the command prompt (case-sensitive).  The demos will be the only files with the extension .m that have the word “Demo” in them, so they should be easy to locate within the Demo Materials folder (Mac users should find these files color-coded green or yellow).  If you want to understand how the demos work, you should open the basic functions (.m files without the word “Demo”) and read the internal line-by-line code comments (comments should be green when opened in MATLAB).

Good luck!

Specific Notes:

  • runShapesDemoFull & runTrialBlock
    • This demo demonstrates the data file saving abilities of the full runTrialBlock function.  In the Demo Materials folder, there should be an empty folder called savedData.  This is where the data files will go once the demo is over.  If you do not have this folder, the saving function will not work!
    • This applies to runNamingBlock & moveAndTalk also.  If you want to activate the save data file abilities for these functions, uncomment the lines that say “commented out for demo.”  These should be lines with fid, fopen, fprintf, and fclose.
  • runNamingBlock & runNamingBlockDemo
    • This code is set up so that the list of names of the picture files (.txt file) must be in the same folder as the picture stimuli (.jpgs).  In the Demo Materials folder, that is why there is a .txt file in the Stimuli/shapes/ folder.

General Notes:

  • For all codes that require text files, these can be in one of two formats:
    • .txt files – if you choose this format, all file names must be completely spelled out with the file name extension in the MATLAB code (e.g. ‘TextFile.txt’)
    • Unix executable files – these files have no specific file extension in the MATLAB code (e.g. ‘TextFile’)
  • MATLAB switched the syntax for setting the random seed in version 2011a (7.12).  All codes should take your MATLAB version into account and utilize the correct shuffle function.