In particular, you cannot change the tone instantly . There is always going to be some processing delay, and MATLAB itself is being interrupted by the operating system for random things, and processing at the MATLAB level is slower than you would need for real-time audio.
So what you need to do is have a buffer of samples that you write into, and the audio drivers take samples from the buffer and output them when the time comes. If you use a large buffer then you have plenty of time to do other things, but it could be a while before any new sounds you queue make it to the speakers.
There is always a trade-off: if your buffer is too small, your code has too much overhead and cannot keep up. If your buffer is too big, delays before changes become audible become too large.
In some cases it is not possible to resolve the problem to your satisfaction -- not without doing things like killing off nearly all the other programs on the host, or compiling the MATLAB code to reduce interpretation delays.