Clear Filters
Clear Filters

how to determine if another instance of matlab is running ?

9 views (last 30 days)
hi, anyone who can tell me how to determine if another instance of matlab is running? (using a 'trick' right now: automatically write a dummy file when starting up matlab and deleting it when closing. checking for this file tells me if matlab is running or not. but there has to be a more elegant way (that also works if matlab closes not the way it should) I reckon?) thanks!
Daniel Shub
Daniel Shub on 19 Jul 2011
A little more information about your OS, MATLAB version, and licensing, would be helpful.
Peter on 19 Jul 2011
I'm using windows XP, matlab R2009bSP1, with academic campus license.

Sign in to comment.

Accepted Answer

Friedrich on 19 Jul 2011
on windows you can do:
[out, res] = dos('tasklist')
This will give you a list of all running programs. Search in that list for matlab.exe:
On Linux you can use the top command to get the list.
  1 Comment
Peter on 19 Jul 2011
thanks Friedrich,
when matlab is running a second instance, matlab.exe is indeed twice in the task list. so this will do!

Sign in to comment.

More Answers (0)


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!