Table of Contents

mgl 2.0

Overview

This beta version (mgl 2.0) contains cocoa based code for running under 64 bit Matlab on Mac OS X, a Windows alpha version (but not yet linux) and a number of improvements as outlined below. Everything in the mgl 2.0 beta for Mac OS X is now working. It should be 100% backwards compatible with any mgl stimulus code you wrote in the past. But, it is still a beta, so use at your own risk. Check the commit logs for recent changes. It has been running on Mac OS 10.6 and versions of Matlab up to 7.9.

New Features

Cocoa

Apple has given up support for Carbon based GUIs for 64 bit applications, so internal functions have been rewritten to use the Cocoa based interface. For those of you who don't know, Carbon is Mac's really old C API from OS 9 days and Cocoa is Mac's slick new object-oriented API which uses an extension to the C language called Objective-C. Essentially Cocoa is NextStep (and even uses NS as a prefix to most classes).

If you are interested in understanding the cocoa code, you may find the book Cocoa programming for Mac OS X by Aaron Hillegass to be helpful. Also Wikipedia has a pretty good entry on Objective-C programming.

Download

The 2.0 beta mgl can be retrieved using svn:

svn checkout http://gru.brain.riken.jp/svn/mgl/trunk mgl

To use the code, simply add mgl to your MATLAB-path:

>> addpath(genpath('mgl'));

And make sure to enable access for assistive devices so that you can use the function mglGetKeyEvent, mglGetMouseEvent, mglPostEvent, mglSimulateRun and mglEatKeys.

There are a few functions (mglEditScreenParams and mglDoRetinotopy) that require the mrTools GUI functions to be installed. If you are not already using mrTools, you can download the following:

svn checkout http://cbi.nyu.edu/svn/mrTools/trunk/mrUtilities/MatlabUtilities mrToolsUtilities

and add that to your MATLAB-path (with the correct path)

>> addpath('mrToolsUtilities');

The code has generally been precompiled for Mac OS 10.6, Matlab 7.9. If you are using an earlier version of Mac OS or Matlab, you are advised to recompile mgl:

mglMake(1);

Download with proxy-server

For non-NYU users, if your institution uses a proxy-server, you might have to set up svn to allow you to access the svn respository. Check System Preferences→Network→Advanced→Proxies and note down the name of the proxy server and port (e.g. blah.nottingham.ac.uk, port 3128). You can then edit the subversion setup file (~/.subversion/servers) in your home directory to set up rules for accessing this repository. For more details see http://subversion.tigris.org/faq.html#proxy

Here are a couple of lines from the servers text file that you can use to specify the rules for access, e.g.

[groups]
group1 = gru.brain.riken.jp

[group1]
http-proxy-host = blah.nottingham.ac.uk
http-proxy-port = 3128

Upgrading

If you are using an older version of MGL, you may want to move that directory to some other name (e.g. mglv15) before installing this version. Older versions of mgl will always be available through SVN, so it is easy to downgrade as well.

If you have an old svn repository that you downloaded from http://yoyodyne.cns.nyu.edu/svn/mgl/trunk, then you can switch to the new repository by cd'ing to your mgl directory and running:

svn switch --relocate http://yoyodyne.cns.nyu.edu/svn/mgl/trunk http://gru.brain.riken.jp/svn/mgl/trunk

Keyboard events

The functions to get keyboard and mouse events rely on a low level system called “event taps”. You need to enable this system (it is usually used as an accessibility option). For 10.9 (“Mavericks”) and later versions of Mac OS you should go to System Preferences/Security & Privacy where you should allow Matlab (Terminal.app if you are running -nodesktop) to “control your computer”

On earlier versions of Mac OS you can go to your System Preferences/Universal Access and clicking “Enable access for assistive devices”.