필터 지우기
필터 지우기

How to get pid of an external executable run in linux?

조회 수: 5 (최근 30일)
Sravan Kumar Kanchari Bavajigari
Sravan Kumar Kanchari Bavajigari 2022년 12월 29일
편집: Stefanie Schwarz 2024년 2월 23일
Hi,
I would like to run an exeternal executable in matlab in linux. I would like to get the pid of the process.
For example, I can run an external executable using
[status,cmdout] = system('.\myexecutable.exe > myoutput.txt &');
I would like to get the pid of .\myexecutable.exe > myoutput.txt &
I am open to running the executable using functions other than system as well. Please note that I am using MATLAB in Linux. Thank you.

답변 (1개)

Bhavana Sapparapu
Bhavana Sapparapu 2023년 1월 4일
편집: Stefanie Schwarz 2024년 2월 23일
Hi Sravan,
I understand that you are trying to run an external executable/process on MATLAB and find its process ID from MATLAB itself on a Linux platform.
At present, there is no direct MATLAB command or function to obtain the PID of a process. But you can try the following workaround that utilizes the 'ps' shell command:
>> system('process name & ps')
Following is the screenshot of the example I have tried on my end:
Also, there is third party command called the 'pslist' command for Linux platforms.
Hope this helps!

카테고리

Help CenterFile Exchange에서 PID Controller Tuning에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by