How to run and close Ansysedt from Matlab?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
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')
For more information refer the following resource, https://www.lifewire.com/how-to-force-quit-a-program-in-windows-2625781#:~:text=Execute%20the%20TASKKILL%20Command%20to...Kill%20the%20Task!
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.
0 comentarios
Ver también
Categorías
Más información sobre Call Python from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!