Category: Matlab examples
-
Faster median in Matlab
There are O(n) algorithms for finding a median, yet Matlab uses an O(n log n) algo (sorting an entire list, then taking the middle element). Here is a nicely written mex file that performs medians faster (on my computer, about 3x faster).
-
Rotated histogram in Matlab
I wanted to draw some marginal histograms of a 2d distribution in Matlab. There is a function called scatterhist that does this but I couldn’t integrate it with the other subplots I wanted in this figure. Turns out a rotated histogram is as easy as changing the plot’s virtual camera position by setting the axis’…
-
Taking the convolution of several images in one shot in Matlab
I wanted to take the convolution M different images (stored in an M x n x n) matrix with the same kernel in the Fourier domain, but I couldn’t figure out how to run fft2 on the second and third dimension of that matrix (computing a bunch of 2D FFTs in a single matlab call).…
-
Obscure Matlab feature #0: Debug on error
If you have a long running function that you just wrote and need to debug, type this in the Matlab command window: dbstop if error This will cause the debugger to kick in as soon as a Matlab error is thrown, so you can trace the variables in your function which are erased from memory…
-
Snow Dots project for psychophysics, neurophysiology in Matlab
There’s a new project for coordinating large scale psychophysics and neurophysiology in Matlab called Snow Dots. It uses PsychToolbox as a presentation layer and builds a framework around it to automate experimental flow, do GUIs, move data around, etc. It’s a little too Java-ish for my tastes (I’m a lightweight, convention over configuration kind of…
-
CRCNS data set pvc-1 by Ringach lab – getting something to work
*Now with some 2011 updates* In a few months, our lab will be doing permanent implant recordings in V4, and analyzing this data will be a major challenge. In contrast to single electrode recordings, the stimuli used for array recordings is usually not optimized for a given cell (say, so that the stimulus is centered…