i have little very little experience in matlab but it can help you
http://tomopt.com/docs/standalone/tomlab_sal008.php[
^]
You can convert MATLAB code into a C or C++ shared library using the MATLAB Compiler. This shared library can then be incorporated into a Visual Studio project, or be combined with a driver file into a stand-alone application. To compile your MATLAB code, for example foo1.m and foo2.m, into a C shared library use the following syntax:
mcc -B csharedlib:libmyfoo foo1.m foo2.m
For an example on building a C shared library and a driver file, refer to the
C shared library example[
^] of the documentation. It is further possible to integrate these shared libraries into Visual Studio applications.