If you want to speed up your matlab code, MEX may be the first thing you should try. However, Matlab 2008a was released before Visual Studio 2010, so VS 2010 is not directly supported. You could try the following patch:
And then run “mex –setup”. Everything should work.