kill a processb from matlab

hello all
i have got the process id [pid] of an external process.
what is the syntax to kill that process using the pid.
i want to kill using pid not by process name from matlab

回答 (2 件)

Selva Karna
Selva Karna 2020 年 1 月 14 日

0 投票

from command window enter key word : cntorl +C

1 件のコメント

Walter Roberson
Walter Roberson 2020 年 1 月 14 日
That cannot be used to kill a particular process using its PID.

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

Walter Roberson
Walter Roberson 2020 年 1 月 14 日

0 投票

pid = whatever number
if ispc
cmd = sprintf('taskkill /PID %d', pid);
else
cmd = sprintf('kill %d', pid);
end
system(cmd)

4 件のコメント

Sajid Afaque
Sajid Afaque 2020 年 1 月 14 日
ERROR: The process with PID 9448 could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).
i am getting the above error
Walter Roberson
Walter Roberson 2020 年 1 月 14 日
pid = whatever number
if ispc
cmd = sprintf('taskkill /F /PID %d', pid);
else
cmd = sprintf('kill %d', pid);
end
system(cmd)
Juan Troya
Juan Troya 2022 年 4 月 27 日
I get this error
Using Matlab R2018B
Error using TaskKill
Too many input arguments.
MATLAB:TooManyInputs
Error: Too many input arguments.
Walter Roberson
Walter Roberson 2022 年 4 月 27 日
What code are you using? The code I posted does not use any MATLAB function named TaskKill

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

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

タグ

質問済み:

2020 年 1 月 14 日

コメント済み:

2022 年 4 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by