Why am I getting invalid function error for a function in an installed package?
3 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 15 Nov 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?
Answers (1)
Johannes Bergstrom
on 15 Nov 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 Comments
Tahmina Sumi
on 30 Jan 2020
@Idban Alam i am facing the same prblem...how did u get rid of it?plz help
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!