Documentation on writing MEX files from Mathworks:
Guide to MEX Files

An example mexFile used to call a 2D planner written in C++:
mexFile for Planner

Creating videos in MATLAB:
The image processing toolbox comes with the functionality to read and record movies but in the past I have found the VideoIO library to be really useful. It works in Linux & Windows and allows you to compress your movie with any codec installed on the machine. Matlab's avifile() does not allow you to compress in Linux and with a limited set of codecs in Windows. VideoIO also allows you to read in different types of video while aviread() can just open avi files.

the newest version can be downloaded here:
VideoIO Library

the version I have used with success:
VideoIO 0.4

Timing the execution of a block of code:
For a planner to be useful, it must capable of finding a solution within a reasonable amount of time. Some of the assignments may require your planner return a solution within x seconds so it's important to be able to optimize your planner to meet that requirement. The first step to optimizing the performance of your planner is finding what is taking up most of the execution time so that you can work on making that block of code more efficient.

The functions 'tic' and 'toc' are really useful. Read some good documentation about them here.
    % code that you want to get the execution time of
#include <time.h>  // put at the top of your file

clock_t starttime; // you might want it as a global variable

start_time = clock();
    code that you want to get the execution time of
double time_in_seconds = (clock() - start_time) / (double)CLOCKS_PER_SEC;

Be aware of the fact that there is a difference between a block of code that takes a while to run but only has to to run once and a block of code that takes a shorter amount of time but runs thousands of times. It's important to find the parts of your program that take up a large percentage of your program's total execution time.