How to run and close Ansysedt from Matlab?

조회 수: 8 (최근 30일)
Khalid Ibne Masood
Khalid Ibne Masood 2022년 3월 14일
답변: Infinite_king 2024년 1월 11일
Hello,
I would like to run and close ansysedt from Matlab seamlessly. My approach is to make a python file and call ansysedt from Matlab to run the python file, just like shown in this link. However the problem is, once I run the command 'system', Matlab does not allow to do anything else until I close the Ansysedt manually. This is certainly not what I want. I would like to keep running and finishing ansysedt simulation from Matlab. Is there any way to do that?
I have surfed for several options in matlab, but I cannot make them work. For example:
(1) This link asks me to use a & symbol after the .exe, but since I am working with a python file, it is not working.
(2) This link suggests to use invoke(oDesktop, 'QuitApplication') command. But unfortunately, Matlab does not identify the oDesktop from its environment. I am not sure, how they have used that command.
Please help me out from this.
Thank you.
Khalid

답변 (1개)

Infinite_king
Infinite_king 2024년 1월 11일
Hi Khalid Ibne Masood,
As per my understanding you are calling 'Ansys EDT' from MATLAB, which then runs the python file. However you mentioned that adding '&' at the end of the command is not working since you are working with python file.
Assuming you are calling 'Ansys EDT' from the MATLAB, you can use taskkill command from the MATLAB to kill the application.
system('taskkill /im ansysedt.exe')
You can call the 'ansysedt' from matlab using 'system' and place '&' at the end to call it asynchronously. This should work as expected.
system('command to call the application &')
Assuming you are calling Python script from MATLAB, then you have to write the Python script in such a way that the program will close once all the operations are performed. Once the Python script is completed the control will return to MATLAB. Refer the following resource, https://www.geeksforgeeks.org/open-applications-using-python/
Hope this is helpful.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by