Clear Filters
Clear Filters

run matlab file from cmd prompt if matlab is already open

2 views (last 30 days)
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!

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!