1、Behavior Research Methods,Instruments,&Computers2000,32(2),290-296MATLABand graphicaluserinterfaces:Tools for experimentalmanagementERINM.HARLEYandGEOFFREYR.LOFTUSUniversityofWashington,Seattle,WashingtonMATLABis a convenient platform for the development and management of psychological experi-ments
2、because ofits easy-to-useprogramming language,sophisticatedgraphics features,and statisticsand optimization tools.Through implementation of theBrainard-PelliPsychophysics Toolbox,theMATLABuser gains close temporal and spatial control over theCRT,while retaining the simplicity ofan interpreted langua
3、ge conducive to rapid program development.MATLABsabilities can be furtherutilized through easily programmable graphical user interfaces(GUIs).Weillustrate how a GUIcanserve as a powerful and intuitive tool for organizing and controllingallaspects of a psychological ex-periment,including design,data
4、collection,data analysis,and theory fitting.We describe here three related topics:first,the useofMATLAB in psychological research;second,the valueofgraphical user interfaces(GUIs)inorganizing and runningexperiments;and third,our implementationofone suchGUI within the MATLAB environment.MATLABANDPSYC
5、HOLOGICAL RESEARCHOver the past few years,MATLAB(a productofTheMath Works Inc.)has gained popularity as a meansofrunning psychological experiments,particularly thoseinvolving perceptionandcognition.MATLAB,whichstands formatrix laboratory,is a powerful platform forhigh-performance mathematical comput
6、ation and graph-ical representation,whose basic data element is anN-dimensional matrix(Hanselman&Littlefield,1996).MATLABs primary strength as a means for creating andexecuting psychological experiments lies in its compre-hensive packageofsuperior mathematical and graphicaltools.Within this single a
7、pplication,allofthe followingexperimental tasks can be achieved:creation and manip-ulationofstimuli,design and executionofthe experiment,data collection,statistical analysis,fitofcomplex theoryto data,and interactive graphical data display.MATLAB runs onMacintosh,Windows,and UNIXoperating systems an
8、d includes both a programming lan-guage and a large setofmathematically oriented libraries.?MATLAB serves as a good alternative to popular plat-The writingofthis manuscript was supported by NIMH GrantMH4I637 to G.L.We thank David Brainard for enormous amounts ofhelp inunderstanding the Psychophysics
9、 Toolboxand MATLAB in gen-eral.The MATLABcode discussed inthisarticle will be posted on E.H.sWebsite(http:/students.washington.edu/eharley/).Please e-mail eitherofthe authors for details.Correspondenceconcerning this articleshould be addressed to E.M.Harley,Department of Psychology,Uni-versityofWash
10、ington,Seattle,WA 98195-1525(e-mail:eharleyu.washington.edu).forms,such as PSYSCOPE(Cohen,MacWhinney,Flatt,&Provost,1993;Yee&Vaughan,1999)and MEL(St.James&Schneider,1991;Schneider,1989),becauseit provides greater control over experimental design,al-lowing for the creationofentirely unique experiment
11、s.MATLAB also serves as a good alternative to low-levelprogramming languages,such as C and PASCAL,be-cause MATLABs language is abstracted from the hard-ware details and is generally easier to learn.As a result,a MATLAB user receives the benefitsofa programminglanguage that is both conducive to rapid
12、 program devel-opment and able to perform with the power and flexibil-ityofalow-level language(primarily through the additionofthe Psychophysics Toolbox,discussed below).ThePsychophysics ToolboxMATLAB is particularly useful for running sensoryand perceptual experiments,largely owing to an exten-sive
13、 setoftools-thePsychophysicsToolbox;writtenby Denis Pelli and DavidBrainard-thatallows extremelyclose temporal,spatial,and color-related control overCRT-based stimulus displays(Brainard,1997;Pelli,1997).Specifically,the toolbox provides access to the comput-ers display frame buffer and color lookup
14、table,allowssynchronizationofstimulus display with the vertical re-trace,supports millisecond timing,and facilitates the col-lectionofobserver responses(Brainard,1997).The tool-box incorporates these features into a large collectionofstimulus-display routines that allow the user to store pre-formed
15、visual images(e.g.,scenes,forms,text,or somecombinationofthese)in the computers memory and todisplay these images at rates that are constrained only bythe monitors refresh rate.For example,on a MacintoshG3 computer,a 400X400 pixel gray-scale image can betransferred from memory to the screen buffer i
16、n less than10msec,thereby allowing a sequenceofsuch images(thenumberofwhich is limited only by computer memory)tobe displayed at the fastest possible rate.Copyright 2000 Psychonomic Society,Inc.290MATLAB AND GRAPHICAL USER INTERFACES291The Psychophysics Toolbox has been used by re-searchers to study a varietyoftopics in the fieldofpsy-chology,including face and object recognition,psycho-physical thresholds,colormatching,visual search,categorization,motion detection,and perceptual learning.Later
