Running Matlab Command From Tcl

我的未来我决定 提交于 2020-01-17 14:59:51

问题


From my TCL script I like to open Matlab command window and display if its Matlab win32 or win64.

Therefore I use the following command:

exec {*}matlab -nodisplay -nosplash -nodesktop -r  "arch = computer; fprintf('%s \n', arch')";

However I keep getting error:

arch = computer; fprintf('%s 
                          |
Error: String is not terminated properly.

If I run the same in Matlab no issues.

Could some kindly advice.

Thanks

Anj.


回答1:


Tcl is substituting the \n before handing the command to matlab. Escape it:

exec matlab ... -r  "arch = computer; fprintf('%s \\n', arch')"

Or use braces

exec matlab ... -r  {arch = computer; fprintf('%s \n', arch')}


来源:https://stackoverflow.com/questions/37611074/running-matlab-command-from-tcl

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