防止在八度音阶脚本中打印输出而不在各处添加分号?

时间:2020-05-29 14:02:56

标签: octave

默认情况下,八度打印输出每个分配的结果,这在终端上非常有用,并且对于调试数据评估脚本非常有用。为了抑制它,

但是,当处理脚本,忘记分号以及由于该10000×10000矩阵的输出页面数过多而在GUI中突然出现主要滞后时,这也可能是一个主要的烦恼。

如果提供了明确的尾随npm install,是否有一种方法可以默认取消输出 ,而仅取消分配回显?

1 个答案:

答案 0 :(得分:2)

是的,八度提供了silent_functions

默认情况下为假(即0)。

您可以将其设置为1以使函数保持静音,即,在函数内部没有分号的任何评估都不会被打印。

但是请注意,启用后,您描述的内容(即以逗号结尾)也不会显示输出。要有意显示启用此功能的功能的输出,必须使用disp命令。

从文档中

 -- silent_functions (NEW_VAL, "local")
 Query or set the internal variable that controls whether internal
 output from a function is suppressed.

 If this option is disabled, Octave will display the results
 produced by evaluating expressions within a function body that are
 not terminated with a semicolon.

 When called from inside a function with the "local" option, the
 variable is changed locally for the function and any subroutines it
 calls.  The original variable value is restored when exiting the
 function.

PS。注意:这也适用于脚本,但是不适用于主控制台窗口。无论此设置如何,只要您在实时控制台中没有以分号结尾的内容都会被打印出来。

相关问题