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

14 visualizaciones (últimos 30 días)
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 comentarios
Idban Alam
Idban Alam el 15 de Nov. de 2018
This is what I got:
>> which -all findLayersToReplace
'findLayersToReplace' not found.
Walter Roberson
Walter Roberson el 15 de Nov. de 2018
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?

Iniciar sesión para comentar.

Respuestas (1)

Johannes Bergstrom
Johannes Bergstrom el 15 de Nov. de 2018
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 comentarios
Tahmina Sumi
Tahmina Sumi el 30 de En. de 2020
@Idban Alam i am facing the same prblem...how did u get rid of it?plz help
Zhen Liu
Zhen Liu el 19 de Feb. de 2020
hello, i didnt even find findLayersToReplace.m。where should i go

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by