Interfacing Matlab with a NI real time target (cRIO 9073)
We do something similar to this by exporting from MATLAB into VHDL code, then compiling that into an FPGA configuration. You can also export C code, which we do for controller code, and then compile that so it runs under an RTOS. 

Not sure of the exact toolkits you need to have in order to make this work, as I recall they were pretty expen$ive.