How to find the Process ID (PID) in matlab
Mostra commenti meno recenti
Is there any function or method in matlab to find the process ID (PID) of the program in the task manager ?
Risposta accettata
Più risposte (5)
Kaustubha Govind
il 8 Giu 2012
There is an undocumented (but relatively well-known) function:
>> feature getpid
2 Commenti
Muharrem Askin
il 11 Giu 2012
Kaustubha Govind
il 11 Giu 2012
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
il 3 Gen 2013
3 voti
To find the running tasks: [response,tasks] = system('tasklist');
e.g. to find Excel [response,tasks] = system('tasklist/fi "imagename eq Excel.exe"')
Jim Hokanson
il 11 Ott 2016
Modificato: Jim Hokanson
il 11 Ott 2016
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
Yair Altman
il 9 Giu 2012
pid = feature('getpid')
2 Commenti
Muharrem Askin
il 11 Giu 2012
Eddy Philippe
il 23 Giu 2020
Try [~,result] = system('tasklist');
Pierre Harouimi
il 3 Giu 2025
0 voti
Categorie
Scopri di più su PID Controller Tuning in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!