Matlab GUI freezes when it uses System command

20 visualizaciones (últimos 30 días)
Hello all,
I hope this finds you well,
My matlab GUI launches another whenever it is opened. using this code:
command = 'C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\High Speed Data Converter Pro.exe' ;
system(command);
It launches the other GUI correctly. However, it freezes until i press Ctrl+c.
It says that :
Operation terminated by user during dos (line 66)
In app1/startupFcn (line 78)system(command);
Any suggestions ?
Thank you,
Best regards,

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Sept. de 2018
In MS Windows, there are two kinds of applications: "console" applications and "graphics applications" (I might not be using the right terminology.)
"console" applications run in a DOS shell and have access to standard input and standard output, so any message they send to standard output will stay around in the DOS shell even after the program itself terminates. They can do graphics. For the purpose of system(), they are not considered to have terminated until the DOS shell exits.
"graphics" applications disconnect from the program that launched them, and open a GUI. For the purpose of system() they are considered to have terminated as soon as they finish disconnecting from the program that launched them.
If it happens that the program you are invoking is coded as a console application, then system() will not return to continue MATLAB processing until the program is exited. This is normal behaviour for system() for that class of program.
Depending on exactly how the program interacts with the user and its environment, you might be able to work around this by simply adding the character & to the end of the command string. For example,
command = '"C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\High Speed Data Converter Pro.exe" &' ;
  1 comentario
abdurrahman Elmaghbub
abdurrahman Elmaghbub el 4 de Sept. de 2018
Thank you so much Walter, I really appreciate it. It works now ^^

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Performance and Memory en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by