This is a similar question to what I asked in a previous StackOverflow post (Undefined function in MATLAB).
Basically, I am 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
, I receive an error message:
Undefined function 'dtwmex' for input arguments of type 'double'.
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 'dtwmex'
it is indicated that dtwmex
is not found. I tried also:
edit 'dtwmex'
But am told that currentDirectory/dtwmex.m does not exist.
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 dtwmex
, and so I type the function name into the website. This results in a message that: "Your search - dtwmex - 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 dtwmex
I receive:
currentDirectory\matlab\toolbox\signal\signal\private\dtwmex.mexw64 % 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?
I tried opening the dtwmex.mexw64 file to add its contents as a subroutine (as was the solution in my previous question), but am told that it cannot be opened.
That function is a compiled mex file which lives in the
private
folder of the toolbox.private
folders are special in MATLAB and their contents are only accessible from files in the parent directory. In your case, this would mean that only functions defined in thetoolbox/signal/signal
folder can find/call this function. If you want to access this mex file, you really have two options.Save your modified function within the signal processing toolbox folder as well and then it will be able to see the
private
folder. The downside being that you're modifying your MATLAB installation.Copy the necessary files that are located within the
private
folder to somewhere that is accessible from an external function (basically anywhere but aprivate
folder).None of these are really recommended though.