Why am I getting invalid function error for a function in an installed package?

6 次查看(过去 30 天)
I have gone through many answers to similar problems on MATLAB answers. So, I uninstalled the deep learning toolbox and deep learning toolbox for googlenet, and reinstalled them. But, one of the function "findLayersToReplace" is giving me the above error. The .m file for the function exists in the following directory C:\..\MATLAB\Examples\nnet\findLayersToReplace.m. Here is how I am trying to call the function in my code.
[Lernablelayers, classLayer] = findLayersToReplace(neuralnetlayers);
I tried running the command "restoredefaultpath". It made other toolboxes, which were working before, to stop working. Then, I saved a copy of "findLayersToReplace.m" in the same directory where I saved my code. I can see all the desired toolboxes when I run the command "ver". But, the function is not working. Can anyone please tell me what is the proper way to implement this function? I would really appreciate the help.
  3 个评论
Walter Roberson
Walter Roberson 2018-11-15
To confirm, even though you are cd'd to the directory that you copied findLayersToReplace.m into, which says that it cannot find it? As in
ls findLayersToReplace.m
says it is in your current directory, but which says it doesn't know it? And to confirm, the directory you are working in is one of your own directories, not something underneath where MATLAB is installed?

请先登录,再进行评论。

回答(1 个)

Johannes Bergstrom
Johannes Bergstrom 2018-11-15
Hi,
MATLAB examples have supporting files that are off the path and stored in the Examples directory. To run any MATLAB example with supporting functions, you must open the example in MATLAB. You can do this by clicking the 'Open Example' or 'Open Live Script' or 'Try it in MATLAB' blue buttom in the top right corner of the example in the doc. In this case, this is the example:
MATLAB then copies all the supporting files to the example folder and opens the example. You can then run the example
  5 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by