Sample MATLAB Code
Here is some example experiment code, with a brief description of its purpose. Currently most of the experiments are in Psychtoolbox (indicated by the

icon), but code for VisionEgg is coming.
Letters vs Digits -- An example fMRI experiment, programmed in Psychtoolbox. It presents blocks of letters and digits for 16 seconds each, separated by 10 seconds of fixation. Twice per block, the letter or digit wiggles back and forth, and the observer's task is to press a key when they see this motion. The order of the blocks and behavioral data are output in the form of paradigm files (for FS-FAST), but are easily converted to the format required for BrainVoyager or SPM.
- Generate Mosaic -- This function uses all of the images in a directory to make a mosaic version of another image. It matches each pixel in the target image to an image in the source directory based on color, and then generates the overall mosaic using these matched images.
Mixture Model Example -- Example code for fitting the maximum likelihood mixture of two Gaussians to data. The script generates some data from two different Gaussians and then combines the data into one big vector. It then fits a mixture model of two Gaussians to the data to try to recover the original Gaussians that generated the data (it uses the matlab function mle() to get the maximum likelihood mixture).
Color Working Memory -- This example code runs an experiment that examines working memory capacity for color. In each of 600 trials, it displays 8 colored dots on the screen briefly, and then highlights one of the locations where the colors were presented. Observers must press one of 8 colored keys to indicate which color was at that location.
Huffman Coding/Information Theory/Chunk Models -- This example code demonstrates the models from Brady, Konkle, Alvarez (2009), Compression in Visual Working Memory: Using Statistical Regularities to Form More Efficient Memory Representations, Journal of Experimental Psychology: General.
Copyright (C) Timothy Brady, 2007-2011.