MATLAB for Psychologists (scripts and listings from the book)
Mauro Borgo, Alessandro Soranzo & Massimo Grassi
This page contains most of the scripts and functions included in the book as well as other types of additional materials. To save the scripts and the function right-click on the link and "save as". In alternative, open the link, copy and paste the content into the MATLAB editor. Note that the scripts and functions here presented are (when necessary) bug-fixed versions of the scripts reported in the book.
To run the brick experiment: type "RunExp" at the prompt, fill-in the details, and either press "RUN PRACTICE" or "RUN EXPERIMENT" (see text for further details). During the experiment press either "b" (for bouncing) or "s" (for streaming) up to the experiment's end (it is currently set to run 40 trials).
Optimized brick functions:
Complex scripts and functions such as those written for the brick experiment requires several rows of code. The length of these codes is excessively long to be written (and read) in a book. For this reason, here we provide an alternative, optimized, more complete (and much longer) SekulerExp.m function. Differently from to the SekulerExp.m above, the following saves the data into a formatted text data file (similar to data.txt). Note that the writing is done "in append": if a datafile exists the new data are written in append to previous data. Moreover, the function has a different behavior whether you click "run practice" or "run experiment": only if you click "run experiment" the it writes the datafile. In addition, the new function interrogates the operative system and run the stimulus at maximal priority.