I am not sure on the specifics behind the scenes of what causes that long delay, but you are on to the right idea. The time it takes to start the server communication and start the MATLAB® run-time is likely responsible for this delay.
There are many things to consider when talking about software determinism for real-time systems. One of the biggest things is OS choice. Without the use of a Real-Time OS, you're already going to be a bit limited in the level of determinism you'd be able to obtain.
That aside, the way to approach any issue with reducing jitter is to understand the source. In this case we have interprocess communication (via ActiveX) between two applications. Here are a couple general recommendations,
1. Reduce the number of running applications (have all of your code running in one process, ideally)
2. Use a more deterministic method of interprocess data transfer (prebuffered deterministic FIFO's are a common approach, but not always an easy option)
3. Reduce the load on the computers processor such that it prioritizes your most important processes. (another hard thing to do with windows)
I would focus on section option one, as it would be simplest to implement in your setup. So, you have a choice... Remove either LabVIEW or MATLAB® from the equation. The way to do this, is by building the code you develop in either environment into a binary that could be called by another program. For example, can you build your MATLAB® code into a .dll and then call it from LabVIEW (or vice versa)? This may not be possible, depending on what functions you are using, but it is something worth looking into.
We may be getting into a much larger discussion here but this will at least get you moving in the right direction and thought process. Let me know if you have more questions or thoughts and we can continue to discuss which path seems most applicable for your end goal. :cathappy:
MATLAB® is a registered trademark of The MathWorks, Inc.