You have two options: the matlab engine and mex functions. It's very important to note that the Matlab API is single-threaded. There is absolutely no way to have user-visible background threads. At best, there are interrupts for UI events.
With the Matlab engine, your application is a C++ application that uses Matlab as an add-in library. You can call Matlab functions from C++, but you must make sure that only one thread accesses Matlab at any point in time. So, you could have a thread that feeds data to Matlab from a queue of inputs coming from the rest of your application. The C++ can have as many threads as it wants, but only one can interact with Matlab.
The other approach is to have Matlab control the main application and have it call C++ code whenever it wants some more data. The C++ code acts as a plugin for Matlab. The C++ code can have as many threads as it wants, but Matlab polls the C++ when your m-file calls it. Look up the documentation on MEX functions.