Matlab GUI freezes when it uses System command

20 次查看(过去 30 天)
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,

采纳的回答

Walter Roberson
Walter Roberson 2018-9-1
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" &' ;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Performance and Memory 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by