从Tcl运行Matlab命令

从Tcl运行Matlab命令

本文介绍了从Tcl运行Matlab命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的TCL脚本中打开Matlab命令窗口,并显示其Matlab win32或win64.

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')";

但是我总是出错:

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

如果我在Matlab中运行相同的软件,则没问题.

请问一些建议.

谢谢

安吉.

推荐答案

在将命令交给Matlab之前,Tcl替代了\n.逃脱它:

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

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

或使用大括号

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

这篇关于从Tcl运行Matlab命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 03:59
查看更多