Matlab GUI freezes when it uses System command
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
abdurrahman Elmaghbub
il 31 Ago 2018
Commentato: abdurrahman Elmaghbub
il 4 Set 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,
0 Commenti
Risposta accettata
Walter Roberson
il 1 Set 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" &' ;
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Performance and Memory in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!