run matlab file from cmd prompt if matlab is already open
1 view (last 30 days)
Show older comments
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!
0 Comments
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!