Undefined function in MATLAB

倖福魔咒の 提交于 2019-11-27 19:32:42

问题


I using the function dtw in the latest MATLAB release, and would like to tweak a few parts of it. To get started, I typed:

edit dtw

I saved the resulting code to file called dtw_Copy.m, and changed the name of the function to dtw_Copy as well. Going through the code line by line with a set of input parameters x and y, around line 90:

[metric, varargin] = getmutexclopt({'absolute','euclidean','squared','symmkl'},'euclidean',varargin);

I receive an error message:

Undefined function 'getmutexclopt' for input arguments of type 'cell'.

I also get this error message if I do not go through the code line by line, and simply type dtw_Current(x,y), after again testing a set of input parameters x and y.

Upon running:

help 'getmutexclopt'

it is indicated that getmutexclopt is not found. I tried also:

edit 'getmutexclopt'

But am told that currentDirectory/getmutexcloptm.m does not exist.

I tried:

which getmutexclopt

And am told that getmutexclopt is not found.

Searching online, I found a resource that seemed straight-forward in trouble-shooting this error. The resource recommends to ensure the toolbox is installed. I am unsure which toolbox supports the function getmutexclopt, and so I type the function name into the website. This results in a message that: "Your search - getmutexclopt - did not match any documents."

The resource also recommends verifying the path used to access the function. I followed the instructions to do so, and when I typed:

which -all getmutexclopt

I receive:

currentDirectory\matlab\toolbox\signal\signal\private\getmutexclopt.m  % Private to signal

This seems to indicate that the function is in the signal toolbox, which is private? Is there a possibility to still run dtw_Current(x,y) and/or to run its contents line by line?


回答1:


Yes, this issue is because the function getmutexclopt is a private function. You'll need to make a copy of that function if you hope to safely call it from your copy of dtw. It appears to be a basic function (type edit private/getmutexclopt.m in your Command Window) so you may be able to add it as a sub-function to your dtw_Copy/dtw_Current.

See also this question – adding private functions to the search path is not allowed.



来源:https://stackoverflow.com/questions/37844384/undefined-function-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!