加载 Scilab 模块时出错

Error while Scilab module is loading

我下载了模块 Metanet 0.6.2 和 运行 by Scilab

atomsInstall

之后我运行

`atomsLoad('metanet')` 

但显示

atomsLoad: An error occurred while loading 'metanet-0.6.2': error(msprintf(gettext('%s module required."),'graph')); ^^

Error: Heterogeneous string detected, starting with ' and ending with ". at line 335 of function atomsLoad ( D:\Program Files\scilab-6.0.1\modules\atoms\macros\atomsLoad.sci line 351 )

为什么会这样?

原来Scilab 6.0.1还不支持metanet模块。我必须安装 5.5.2 版。

不幸的是,此页面中的问题和已接受的答案都非常含糊且具有误导性。理想情况下,这类帖子应该被屏蔽/否决,但我会尽可能多地回答它。

首先,当你想运行一个Scilab命令时,你不要把它放在引号里,除非你想使用execstr命令。但是,您使用的字符不是引号而是反引号!我不确定你为什么这样做。

其次,错误:

Error: Heterogeneous string detected, starting with ' and ending with "

在单引号内使用双引号时发生,反之亦然:

"This is a' string"
'this is a" string'

要解决此问题,您应该将以上字符串更改为

"This is a'' string"
'this is a'" string'

基本上是在 '" 字符之前添加一个单引号,将它们变成文字 '"

如果你想将字符串传递给 Tcl 使用花括号,加分点

TCL_EvalStr("set myVar {Hello World!}")

TCL_EvalStr("set myVar '"Hello World!'"")

但对于 PowerShell

powershell('$myVar= ''Hello World!''')

powershell("$myVar= ''Hello World!''")