Azzera filtri
Azzera filtri

run matlab file from cmd prompt if matlab is already open

2 visualizzazioni (ultimi 30 giorni)
Hi,
I'm working on a batch file that lets the user run a matlab program directly from the desktop. However, I want to avoid opening a second instance of matlab if it's already running. My batch file is an if else statement based on whether or not matlab is already running. My question is how can you run the .m file from the batch file, by using the instance of matlab already running?
The line I need help with is in the *???***
tasklist /FI "IMAGENAME eq MATLAB.exe" /NH | find /I /N "MATLAB.exe" >NUL
if "%ERRORLEVEL%"=="0" (
****???****
) ELSE (
cd C:\program files\matlab
matlab -sd N:\matlab -r mfile
)
Thanks!

Risposte (0)

Categorie

Scopri di più su File Operations in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by