I am having a little problem. I need to play a pure tone (in a loop). I am using the command "sound". The duration of the tone can vary from iteration to iteration, therefore I am crreating a 10 min length sound and then just sttoping it with "clear playsnd"... it could be a little abrupt, but I do not know other way. The point is that in every iteration, the RAM and the virtual memory are being used more and more till it is "Out of Memory" and it stops... from there, the only solution seems to close and open again matlab; I have tried to clear all and everything, but it is only closing and opening again that solve it. Anyway, the main problem is that it is running out of memory and I cannot continue with the script. I have tryed to store the variable and then call it everytime... but it is taking a lot of time; I also tried to created it everytime before I am playing the sound, but it is also a not good solution for me. The last thing I tried was to create a very short time pure tone and concatenated with "repmat" just before... in order that, after the tone is played I can erase it... believing that it would free the memory... but again, it was "Out of memory".
I do not know what to do. Is there any possibility to free the accumulation of RAM and Virtual memory without completly reseting the matlab?