executing system command in Matlab without waiting

瘦欲@ 提交于 2019-12-08 02:03:48

问题


I am trying to operate three instruments using one Matlab GUI.

  • One instrument simply sends data via serial port.
  • Second is configurated and starts sending data via virtual serial port but using manufacturer's SDK (I am using modified example script for Matlab to comunicate with instrument)
  • Third uses compiled C++ program which execution configures instrument and starts sending data but saves it outside Matlab. This instrument operates just few second unlike other sensors:

    system('ctrllib_demo3.exe 192.168.0.125 C:\ScanPos003.rxp 30,130,1,0,360,1 1')

While running each instrument independently, works fine. Also first together with second works fine. But while above command runs, second instrument stops sending data while first continues. Each sensor is operated from different function.

Could it be caused due to: "The operation waits for the command to finish execution before returning the exit status of the command to the status variable." (mathworks/system)? In that case why the first instrument is still running?


回答1:


You can run an external command in background mode by appending & to the operating system command ! for example:

!notepad.exe test.txt &

will open test.txt in notepad and return control to the command window immmediately.

Run External Commands, Scripts, and Programs



来源:https://stackoverflow.com/questions/24890167/executing-system-command-in-matlab-without-waiting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!