How to find the Process ID (PID) in matlab
105 次查看(过去 30 天)
显示 更早的评论
Is there any function or method in matlab to find the process ID (PID) of the program in the task manager ?
0 个评论
回答(4 个)
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!