I have a .m script that is called from the Windows command line (aka or prompt), and I call this script with different arguments several times (50+) a day.
I tried using the matlab -r "run script.m"
and the script is correctly executed, but everytime I issue this prompt command a new instance of MATLAB is opened, which is undesirable in this case.
Is there a way of identifying that there is an instance of MATLAB already running on my Windows 7 machine, and force the use of the same MATLAB instance on several external calls via Windows command line?
As discussed here, you cannot prevent MATLAB from creating a window when starting on Windows systems, however, you can force the window to be hidden, by using the start command with the
-nodesktop
and-minimize
options together:or simply
PS: Although this will prevent creating new instances of MATLAB (full IDE), this still will create the same number of MATLAB command windows (MATLAB processes) instead.