Here is a compilation of some small instructional code I've written for MATLAB and R. I have a GitHub account where I've put the larger projects which are not listed here (like my Minesweeper bot!). I've written all of it for my own purpose or for use in my own research setting. The more thorough code on my GitHub page has details instructions for use. If you have a popup blocker or if clicking the file doesn't automatically download, right-click and choose Save As.

### Helper R Scripts

Convert a factor into a numeric format. [as.numeric.factor.R]

Sets object (row, column, etc) names but returns the initial data frame. Useful when piping. [setnames.R]

Version of MATLAB's ind2sub function for R. [ind2sub.R]

Version of MATLAB's ndgrid function for R. [ndgrid.R]

Quickly generate exponentially-spaced values of ax^{b} for vectors of a and b [logticks.R]

Round an input to the nearest Nth place [roundx.R]

Round an input to the nearest integer away from zero [unfix.R]

### Helper MATLAB Scripts

Bin data in N dimensions [ndbin.m]

Quickly generate exponentially-spaced values of ax^{b} for vectors of a and b [logticks.m]

Round an input to the nearest Nth place [roundx.m]

Round an input to the nearest integer away from zero [unfix.m]

Jitter one-dimensional values [jitter.m]

Get linearly spaced value [continuous.m]

Plot 3D surface from (x,y,z) values with triangulation [SurfFromScatter.m]

Perform a simple but very fast linear interpolation [SimpleLinearInterpolation.m]

Estimate the time remaining in a FOR loop [CalculateTimeRemaining.m]

Multi-use tool for gaze-contingent paradigms using EyeLink [ConfirmFixation.m]

Fold one dimension of a matrix and apply an operation with the two halves [FoldOver.m]

Bins values using MATLAB function histc but with increased capacity [BinData.m]

Quickly create an matrix with circles embedded randomly [MakeDotArray.m]

### Teaching and Tutorials

Create a hidden startup script in R [Rprofile.zip]

Create a custom calibration in real time for a MATLAB EyeLink setup [CustomCalibration.m]

Learn how to optimize timing in PsychToolbox scripts [PrecisionTiming.m]

For high-precision creation and playback of sound stimuli in PsychToolbox [Sounds.m]

Send email with your Gmail from MATLAB [SetupEmail.m]

Simple Optotrak data collection for MATLAB [simplepoint.m]