
外文翻译原文-MATLAB和图形用户界面进行实验管理的工具
7页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 because ofits easy-to-useprogramming language,sophisticatedgraphics features, and statisticsand optimization tools. Through implementation of theBrainard-PelliPsychophysics Toolbox, theMATLABuse
2、r gains close temporal and spatial control over theCRT,while retaining the simplicity ofan interpreted language 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 collection, data analysis, and theory fitting.We describe here three related topics: fi
3、rst, the useofMATLAB in psychological research; second, the valueofgraphical user interfaces (GUIs) inorganizing and runningexperiments; and third, our implementationofone suchGUI within the MATLAB environment.MATLABANDPSYCHOLOGICAL 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-pe
4、rformance mathematical computation 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 application, allofthe followingexperimental tasks can be achieved: creation and manip-ulationofstimuli, design and executionofthe experiment,data collection, statistical
5、 analysis, fitofcomplex theoryto data, and interactive graphical data display.MATLAB runs onMacintosh,Windows, and UNIXoperating systems and 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 Toolboxand MATLAB in gen-eral. The MATLABcode discussed int
6、hisarticle 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-versityofWashington, 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 experim
7、ental design, al-lowing for the creationofentirely unique experiments.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 program devel-opment and able to perform with the power and flexibil-ityofalow-level language (primarily through the additionoft
8、he Psychophysics Toolbox, discussed below).ThePsychophysics ToolboxMATLAB is particularly useful for running sensoryand perceptual experiments, largely owing to an exten-sive 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 table, allowssynchr
9、onizationofstimulus 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 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
10、 computer, a 400X400 pixel gray-scale image can betransferred from memory to the screen buffer in 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
11、 thresholds,colormatching, visual search,categorization, motion detection, and perceptual learning.Later in this article, we will briefly discuss our useofthetoolbox to display high- and low-pass filtered digit stringsfor verybriefexposure durations.Tools for Data Analysis and Theory FittingMATLAB provides a wide rangeoffunctions for useindataanalysis. For example, the optional StatisticsToolbox includes more than 200 routines covering topicsincluding, but not limited to, descriptive statistics,
12、 prob-ability distributions, linearand nonlinear modeling, multi-variate statistics, and hypothesis testing. MATLAB alsoprovides graphing tools for the creationofpresentation-quality plotsofvarious forms, including line, scatter,stem, pie, and box plots and bar graphs and histograms, aswellas three-dimensional contour, surface, and mesh plots(with optional animation).Experimenters in the fieldofperception and cognitionoften wish to fit mathematical theory to their data. MAT-LABs optional Optimiz
13、ation Toolbox provides the toolsnecessary for fitting complex, nonlinear mathematicalmodels with a numberoffreeparameters but no analyticsolution. For a given data set, the optimization routinesfind the valuesofthe free parameters that minimize somedesired error function (e.g., the root-mean square errorbetween the data and the theory predictions).MATLABs Intuitive Programming LanguageMATLAB incorporates a programming language thatis similar in structure to many common languages, suchas FORTRAN,
14、 BASIC, PASCAL, and C. One elementthat makes MATLABs language unique is that, as wasnoted, it uses a matrix as its basic element. This propertyconfers numerous benefits, one being the following: Inmost programming languages, it becomes time consum-ing and cumbersome to perform the same mathematicaloperation on a groupofnumbers, because the operationmust be repeated (generally via loops) for each number,one number at a time. The greater the dimensionalityofthe data structure on which suchoperatio
15、nsare per-formed, the greater the numberofembedded loops re-quired. However, in MATLABs programming language,data structures are construed as matrices, and almost anyoperation, be it as simple as adding 1to each structure el-ement or as complex as finding all elementsofa structurethat are less than 0, can be performed in a single step. Em-bedded loops for these tasks are thus eliminated in MAT-LAB, saving the programmer time and cutting down onthe length and complexityofprogramming routines. Ase
16、cond benefitofMATLABs matrix-based languagepertains to the use and manipulationofimages. Imagesare stored in MATLAB as matrices, and becauseofthis,they can be quickly and easily manipulated or altered (e.g.filtering, adding noise, reducing/increasing contrast, etc.)through matrix operations.Like other programming platforms, MATLABprovidesautomatic formatting features, such as color codingofcomments, strings, and key words, as well as indentationof loops, thus increasing clarity and organizationo
17、fpro-gramming code. The net effectofsuch features, combinedwith MATLABs simple and intuitive programming syn-tax, is to allow someone with little or no prior program-ming experience to quickly become a proficient MAT-LAB programmer and to write sophisticated routineswithin a matter of weeks.Graphical User InterfacesThere are essentially three ways in which a user cancommunicate with the computer via MATLAB: throughthe Command Window, through the useofscripts andfunctions, and through GUIs.TheCom
18、mand Windowis MATLABs default I/O tech-nique. As the name implies, it is a window into which anystandard MATLAB commands or user-defined com-mands, such as 2+2 or answer=conv2 (mask, filter),can be typed. Although the Command Window is ade-quate for accomplishing simple tasks, it is often useful tocreate a file containing a listofsuch commands. Thesefiles are calledscriptsifthey simply run a listofcom-mands andfunctionsiftheyacceptinput argumentsand/or return output arguments. Both scripts and f
19、unc-tions can be executed either directly from the CommandWindow or from within other scripts or functions. Topro-vide an example, a function that we wrote and use oftenis called ComputeContrast.Itrequires two input val-ues, foreground color (FC) and background color (BC),and returns the contrast value calculated by the formula(FC - BC)/(FC + BC).The third communication device, a GUI, provides anintuitive interface between the user and the program-ming language. A GUI allows the user to bypass M
20、AT-LAB commands altogether and, instead, to execute pro-gramming routines with a simple mouse click or keypress(most common applications, such as Word and Photo-shop, as well as the Macintosh and Windows operatingsystems, are implemented as complex GUIs). No knowl-edgeofMATLABor computerprogramming is necessaryfor a user to successfully navigate a well-designed GUI;indeed, from the users perspective, the language under-lying the GUI is irrelevant. GUIs can range from simplequestion boxes prompti
21、ng the user for a Yes/Noresponse,to more complex interfaces, an exampleofwhich will beprovided below.MATLABprovides the user with intuitivetools for easy construction ofGUIs; see Marchand (1999)for a detailed description of the GUI-creation tools pro-vided by MATLAB.USING GRAPHICALUSERINTERFACESIN PSYCHOLOGICAL EXPERIMENTSTo illustrate the benefits of using GUIs in psychologi-cal experiments, we will describe a specific GUI createdto accompany a visual perception experiment in our lab-oratory.29
22、2HARLEY AND LOFTUSExample: The Filter ExperimentTo provide the reader with a foundation for under-standing and interpreting our exampleGut,we will firstbriefly describe the experiment for which the GUI wascreated. The experiment, which we will call thefilterex-periment, was designed to investigate certain kindsofspatial-frequency filtering on perception and memoryforbrieflypresented digit strings (see, e.g., Olds&Engel,1998; Parish&Sperling, 1991). Stimuli were randomlychosen four-digit strings
23、presented in three spatial-frequency conditions: normal (N), low spatial frequen-cies only (LSF), and high spatial frequencies only (HSF).On a given trial, the following sequenceofevents oc-curred. First,a stimulus in oneofthethree spatial-filteringconditions was presented at oneofsix exposure dura-tions; next, the observer attempted to recall the digits intheir correct order (guessing if necessary); and third, vi-sua?and/or auditory feedback was provided. The pro-grams used in the filter experi
24、ment were all written inMATLAB, utilizing standard MATLAB routines in con-junction with the stimulus presentation routines in theBrainard-Pelli Psychophysics Toolbox.Organizing Multiple Data SetsFourteenobservers participatedin the filter experimentand produced a totalof64 data sets (where a data set is asetofexperimental trials, all involving the same experi-mental parameter values). Three observers collectedpilotdata during the developing stagesofthe experiment.Three different observers collec
25、ted data for the final fourversionsofthe experiment (in which mask/ no mask andlow-pass filter size were varied). Finally,8observers col-lected data to serve as practice fora follow-up experimentand todetermine the appropriate experimental parameters(contrasts, durations, etc.) to be used in that follow-up ex-periment. Although it might seem as if organizing allofthese observers and data sets, with their differing experi-mental parameters, would be time consuming and com-plicated, aGutdesigned e
26、xpressly for this experimentallows for simple control overthe multiple data sets fromthe multiple observers.The Example Graphical User InterfaceThe GUI created to accompany the filter experimentconsistsoftwowindows: a main window, pictured in Fig-ure 1, and a theory window, pictured in Figure 2, whichwe will discuss in turn.The GUIs main window contains four major compo-nents: observer information, setup, and stimulus preview;feedback options and data collection; data analysis, plotoptions, and
27、graphical display; and escape from the mainwindow in the formofeither a link to the theory windowor an exit button. Wewill describe eachofthese compo-nents within the contextoftheir contributions to the de-sign, data collection, data analysis, and theory applicationentailed in the filter experiment.ManipulationofExperimental ParametersFrom Within the Graphic User InterfaceLike the filter experiment that we use in our example,many experimental projects, particularly those involvingsensation and p
28、erception, involve a seriesofinterrelateddata sets. For instance, a project to investigate the effectsofcontrast on information acquisition may involve a se-riesofexperiments, each with varying valuesofdurationand contrast and, usually, involving choicesofother ex-perimental parameters as well. Often, such experimentsact aspilotexperiments, designed to map out the layoftheperceptual land for individual observers before the mainexperiment is designed and the final data collected.As thenumberofsuc
29、h data sets within a projectgrows, it becomes increasingly difficult to change theexperimental parameters in a systematic and/or optimalfashion, because such parameters are often embedded inthe codeofthe relevant programs. Keeping trackofwhichdata sets emerged from which observers also becomestedious as the numberofdata sets per observer increases.AGutis a useful tool for dealing with these problems,since it can do double duty as a mini-database. Throughits use, an experimenter can easily set, a
30、lter, and keeptrack of experimental parameters for multiple observerswithin a single visual display.Thedesign features used forthese purposes that are implemented in our example GUI(see Figure 1) are the following.Observerinformation. The area in the upper left sec-tionofour GUIs main window is devoted to observer in-formation and setupofdata files. Here, allofthe ob-servers initials are listed in a pop-up menu. Once aparticular observer has been selected, information forthat observer is loaded,
《外文翻译原文-MATLAB和图形用户界面进行实验管理的工具》由会员M****1分享,可在线阅读,更多相关《外文翻译原文-MATLAB和图形用户界面进行实验管理的工具》请在金锄头文库上搜索。