Category Archives: Matlab

Fast approximate whisker tracking in the gap-crossing task

After finding the mouse’s nose position (see post on Tracking mouse position in the gap-crossing task), I wanted to get a fast, robust estimate of the basic whisking pattern, together with approximate times when whiskers could have been in contact with … Continue reading

Posted in Data analysis, Matlab | Leave a comment

Exporting figures from Matlab into Illustrator

Getting nice figures out of matlab is always a bit of a nightmare. Here’s a few pretty simple steps I’ve adopted that work ok for my needs. I use subplots quite a lot, and try to get my figures as … Continue reading

Posted in Matlab | Comments Off on Exporting figures from Matlab into Illustrator

Maintaining local pixel cross-correlation in image registration

This post is about the effect of re-sampling in image registration methods on local pixel cross correlation for analyzing calcium imaging data. In awake 2p imaging, animal motion causes brain tissue motion and image motion. While z-motion that can not be recovered … Continue reading

Posted in Calcium imaging, Data analysis, Matlab | Comments Off on Maintaining local pixel cross-correlation in image registration

Template matching in manual spike sorting

When sorting spikes, it is pretty common to find a bunch of nice example waveforms for a unit, but it is often tricky to find good features that cleanly separate these waveforms from the rest. For this reason, many clustering packages can … Continue reading

Posted in Data analysis, Matlab, Technical things | Comments Off on Template matching in manual spike sorting

Shaded plots in matlab

When comparing different traces in a plot, the usual approach is to plot the traces in different colors and add the confidence bounds as thinner lines. This works ok for two colors, but it ain’t the prettiest. Luckily, its pretty … Continue reading

Posted in Matlab | Comments Off on Shaded plots in matlab

Simpleclust – manual spike sorting in matlab

In my work, I often need to maximize the number of identified neurons I can record from simultaneously, so I do all my spike sorting manually. While there are a bunch of good free options, none quite fit my workflow, … Continue reading

Posted in Matlab, Technical things | Comments Off on Simpleclust – manual spike sorting in matlab

Fast lookup in sorted array

The matlab code for this post is available at https://github.com/jvoigts/find_halfspace_matlab A lot of the first-order data analysis I’m running amounts to taking lots of big time series, aligning them to triggers (time of stimulus onset, response times etc) and running statistics … Continue reading

Posted in Matlab | Comments Off on Fast lookup in sorted array

Dealing with large time series and time stamps in matlab

When dealing with time series, like LFP or EEG in electrophysiology, it is usually a good idea to keep around the time stamps that assign a time to each sample. This way, aligning data to triggers is convenient, and cropping and combining data sets requires … Continue reading

Posted in Matlab | Comments Off on Dealing with large time series and time stamps in matlab