Hi Sujat,
It sounds like you're facing an issue with asynchronous execution in your app designer app, specifically when trying to terminate a GAMS simulation process mid-execution. One way to handle this might be to ensure that your abort button initiates a separate thread or process to kill the GAMS task. This can often be achieved by using MATLAB's batch function or other parallel computing tools to run the system('taskkill /F /IM gams.exe') command independently of the main app process. This way, the command to terminate the simulation doesn't have to wait for the simulation to complete before executing.
Another approach might be to investigate how MATLAB handles external calls and processes while a simulation is running. Ensuring that the app remains responsive and can execute commands even during intensive computational tasks is key. It may involve setting up your simulation or app architecture to periodically check for an abort signal or to run simulations in a mode that doesn't block other operations.
The following links might help you: