Borrar filtros
Borrar filtros

How to run and close Ansysedt from Matlab?

4 visualizaciones (últimos 30 días)
Khalid Ibne Masood
Khalid Ibne Masood el 14 de Mzo. de 2022
Respondida: Infinite_king el 11 de En. de 2024
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

Respuestas (1)

Infinite_king
Infinite_king el 11 de En. de 2024
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.

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by