Matlab 如何确定在八度音程中产生警告的位置?
我有一大套MATLAB脚本,我正试图在八度音阶下运行。在某些情况下,在执行过程中会发出以下警告:Matlab 如何确定在八度音程中产生警告的位置?,matlab,octave,Matlab,Octave,我有一大套MATLAB脚本,我正试图在八度音阶下运行。在某些情况下,在执行过程中会发出以下警告: warning: division by zero 我如何判断哪个文件/函数在八度音程中导致此警告?有一个debug\u on\u警告函数,它会按您的要求执行 从文件中: 'debug_on_warning' is a built-in function from the file libinterp/corefcn/error.cc -- VAL = debug_on_warning ()
warning: division by zero
我如何判断哪个文件/函数在八度音程中导致此警告?有一个
debug\u on\u警告
函数,它会按您的要求执行
从文件中:
'debug_on_warning' is a built-in function from the file libinterp/corefcn/error.cc
-- VAL = debug_on_warning ()
-- OLD_VAL = debug_on_warning (NEW_VAL)
-- debug_on_warning (NEW_VAL, "local")
Query or set the internal variable that controls whether Octave
will try to enter the debugger when a warning is encountered.
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.
See also: debug_on_error, debug_on_interrupt.
注:如果您的程序也生成了其他警告,但您不想进入这些警告的调试模式,则可以使用
warning
函数更改除零
警告的特定行为,将其转换为错误,然后使用debug\u on\u error
让八度音阶在错误发生时立即进入调试终端。这是一个遥远的目标,但是八度音阶中是否有“暂停警告”选项?我添加了警告('error','octave:divide by zero')
,然后能够在错误时打印堆栈跟踪。谢谢