How to find the Process ID (PID) in matlab
66 ビュー (過去 30 日間)
古いコメントを表示
Muharrem Askin
2012 年 6 月 8 日
回答済み: MathWorks Support Team
2025 年 8 月 18 日
Is there any function or method in matlab to find the process ID (PID) of the program in the task manager ?
0 件のコメント
採用された回答
MathWorks Support Team
2025 年 8 月 18 日
Starting in R2025a, you can obtain the PID of a MATLAB process with the MATLAB command:
>> matlabProcessID
This function returns the PID as a uint64 variable.
In earlier versions of MATLAB, you can obtain the PID of a MATLAB process with the MATLAB command:
>> feature('getpid')
This returns the PID as a double variable. Please note that the use of the "feature" function is undocumented, meaning that it can be removed or changed at any time.
0 件のコメント
その他の回答 (5 件)
Kaustubha Govind
2012 年 6 月 8 日
There is an undocumented (but relatively well-known) function:
>> feature getpid
2 件のコメント
Kaustubha Govind
2012 年 6 月 11 日
I think you might need to figure out a Windows shell command that does that and use the SYSTEM function to call into the shell.
William Stevenson
2013 年 1 月 3 日
To find the running tasks: [response,tasks] = system('tasklist');
e.g. to find Excel [response,tasks] = system('tasklist/fi "imagename eq Excel.exe"')
0 件のコメント
Jim Hokanson
2016 年 10 月 11 日
編集済み: Jim Hokanson
2016 年 10 月 11 日
A .NET solution:
name = 'excel'; %for example
p = System.Diagnostics.Process.GetProcessesByName(name);
if p.Length == 1
pid = p(1).Id; %You must index into p (not p.Id), as this changes the class type
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で PID Controller Tuning についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!