This c file can be easily converted to a mex file and then executed within MATLAB. Simply save the c file as "filename.c" within your MATLAB work directory. In the command window, type "mex filename.c". This will produce a mexfile, e.g., filename.mexw32, that you can execute by entering "filename" in the command window.