How to run and close Ansysedt from Matlab?
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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')
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!