我在最新的MATLAB版本中使用了函数dtw,并想调整它的一些部分 . 要开始,我键入:
edit dtw
我将生成的代码保存到名为dtw_Copy.m的文件中,并将该函数的名称也更改为 dtw_Copy
. 在第90行附近逐行使用一组输入参数 x
和 y
:
[metric, varargin] = getmutexclopt({'absolute','euclidean','squared','symmkl'},'euclidean',varargin);
我收到一条错误消息:
未定义函数'getmutexclopt'用于'cell'类型的输入参数 .
如果我没有逐行完成代码,并且在再次测试一组输入参数 x
和 y
之后输入 dtw_Current(x,y)
,我也会收到此错误消息 .
运行时:
help 'getmutexclopt'
表示未找到 getmutexclopt
. 我也尝试过:
edit 'getmutexclopt'
但是我被告知currentDirectory / getmutexcloptm.m不存在 .
我试过了:
which getmutexclopt
我被告知 getmutexclopt
未找到 .
在线搜索,我发现a resource that seemed straight-forward在解决这个错误时遇到了麻烦 . 资源建议确保安装工具箱 . 我不确定哪个工具箱支持函数 getmutexclopt
,所以我在website中输入函数名称 . 这会产生一条消息:"Your search - getmutexclopt - did not match any documents."
资源还建议验证用于访问该功能的路径 . 我按照说明进行操作,当我输入时:
which -all getmutexclopt
我收到:
currentDirectory\matlab\toolbox\signal\signal\private\getmutexclopt.m % Private to signal
这似乎表明该函数是在信号工具箱中,这是私有的?是否有可能仍然运行 dtw_Current(x,y)
和/或逐行运行其内容?
1 回答
是的,这个问题是因为函数
getmutexclopt
是private function . 如果您希望从dtw
的副本中安全地调用该函数,则需要复制该函数 . 它似乎是一个基本功能(在命令窗口中输入edit private/getmutexclopt.m
),因此您可以将其作为子功能添加到dtw_Copy
/dtw_Current
.另请参见this question - 不允许向搜索路径添加私有函数 .