Effacer les filtres
Effacer les filtres

Matlab GUI freezes when it uses System command

24 vues (au cours des 30 derniers jours)
abdurrahman Elmaghbub
abdurrahman Elmaghbub le 31 Août 2018
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,

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Sep 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 commentaire
abdurrahman Elmaghbub
abdurrahman Elmaghbub le 4 Sep 2018
Thank you so much Walter, I really appreciate it. It works now ^^

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Compiler dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by