Filter löschen
Filter löschen

Running ATP-EMTP dos command from MATLAB

13 Ansichten (letzte 30 Tage)
Hayder Jahanger
Hayder Jahanger am 8 Apr. 2022
Beantwortet: Aditya am 18 Jan. 2024
Hi,
I am trying to run ATP-EMTP simulation using MATLAB dos command as follow:
[x,y] = dos('"C:\ATP\tools\runATP.exe" "C:\Users\username\Documents\ATPdata\work\Grid_100kHz.atp"')
or
dos('"C:\ATP\tools\runATP.exe" "C:\Users\username\Documents\ATPdata\work\Grid_100kHz.atp"')
using either form, the ATP dos command finishes but the matlab does not stop so to move to the next line of the code, it seems it stuck in this line.
Could anyone can help and advice
I am using Matlab 2021b with compiler v9.
best regards

Antworten (1)

Aditya
Aditya am 18 Jan. 2024
Hello Hayder,
It appears that you're encountering an issue where MATLAB seems to get stuck after executing an ATP-EMTP simulation using the dos command. This behaviour typically suggests that the runATP.exe process is not terminating properly, causing MATLAB to wait indefinitely for the process to finish. Here are some steps you can take to troubleshoot and potentially resolve this issue:
  • Check if the external program is running in the background: After running the command in MATLAB, open the Task Manager and check if runATP.exe is still listed in the processes. If it is, the program might not be terminating as expected, which could be due to a variety of reasons such as waiting for user input or encountering an error.
  • Use the “system” command instead of “dos”: The system command is another way to call external programs in MATLAB and might provide more detailed feedback.
[status, cmdout] = system('"C:\ATP\tools\runATP.exe" "C:\Users\username\Documents\ATPdata\work\Grid_100kHz.atp"', '-echo');
  • Using the -echo option will echo the command output to the MATLAB Command Window, which can offer additional insight.
  • Run the command asynchronously: To prevent MATLAB from waiting for the external command to finish, you can run it asynchronously by appending an ampersand & to the command string.
[status, cmdout] = system('"C:\ATP\tools\runATP.exe" "C:\Users\username\Documents\ATPdata\work\Grid_100kHz.atp" &');
  • Run the command outside MATLAB: Try executing the command directly in the Command Prompt (cmd.exe) to see if it completes successfully there. This can help determine if the problem lies with the runATP.exe program or with how MATLAB is calling it.
For more information on “System” command please refer to the MathWorks documentation: https://www.mathworks.com/help/releases/R2021b/matlab/ref/system.html#d126e1608968
Hope this helps!

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by