-2

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.

Community
  • 1
  • 1
LAR
  • 19
  • 3
  • 2
    Are you going to ask this question every time you come across a private function? – sco1 Jun 17 '16 at 19:03
  • 3
    I believe this is not a duplicate of my similar recent question. The solution from the previous post cannot be duplicated here, as it seems I cannot add the code from the private function as a subroutine this time. – LAR Jun 17 '16 at 20:40
  • 2
    Oh come on, the whole point of the answer was to copy the file out of the private folder because it's not accessible otherwise. Do you seriously need a question for every variation of "copy" that's possible? – sco1 Jun 17 '16 at 21:36
  • 2
    Also maybe you should seriously consider *why* you need to do this. Typically when you think you need to modify a toolbox function, you can accomplish the same thing *external to* the function *or* you're using the function wrong in the first place. – Suever Jun 17 '16 at 21:41

1 Answers1

0

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 the toolbox/signal/signal folder can find/call this function. If you want to access this mex file, you really have two options.

  1. 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.

  2. Copy the necessary files that are located within the private folder to somewhere that is accessible from an external function (basically anywhere but a private folder).

None of these are really recommended though.

Suever
  • 64,497
  • 14
  • 82
  • 101