how to determine if another instance of matlab is running ?

조회 수: 10 (최근 30일)
Peter
Peter 2011년 7월 19일
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!
  댓글 수: 2
Daniel Shub
Daniel Shub 2011년 7월 19일
A little more information about your OS, MATLAB version, and licensing, would be helpful.
Peter
Peter 2011년 7월 19일
I'm using windows XP, matlab R2009bSP1, with academic campus license.

댓글을 달려면 로그인하십시오.

채택된 답변

Friedrich
Friedrich 2011년 7월 19일
Hi,
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:
strfind(res,'MATLAB.exe')
On Linux you can use the top command to get the list.
  댓글 수: 1
Peter
Peter 2011년 7월 19일
thanks Friedrich,
when matlab is running a second instance, matlab.exe is indeed twice in the task list. so this will do!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by