How can I detect how many instances of Matlab are currently running on my machine?

21 ビュー (過去 30 日間)
In task manager you can see how many matlab.exe there are.
is it possible to tell this from inside a matlab function?
eg I have a m function runing, doing stuff, and every so often I ask, "how many instances of matlab are running?" If the number is less than 2 say, then I am able to call a bat file from system.m to open a new instance and run a new job.
I dont have any fancy toolboxes eg parallel computing etc thanks

採用された回答

Jason Ross
Jason Ross 2011 年 4 月 22 日
You can call the "tasklist" (DOS) function with some arguments that will tell you how many are running on the system. You can then parse the return and get a count.
e.g.:
>> [status,result] = system('tasklist /FI "imagename eq matlab.exe" /fo table /nh')
status =
0
result =
MATLAB.exe 5132 Console 1 359,184 K
MATLAB.exe 6028 Console 1 358,908 K
  3 件のコメント
Jason Ross
Jason Ross 2011 年 4 月 22 日
No problem, good luck with getting your processing going.
Sanket Mishra
Sanket Mishra 2014 年 7 月 14 日
Thanks Jason.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by