Clear Filters
Clear Filters

How to run and close Ansysedt from Matlab?

5 views (last 30 days)
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

Answers (1)

Infinite_king
Infinite_king on 11 Jan 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.

Community Treasure Hunt

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

Start Hunting!