Why custom function in path are not found anymore?

22 views (last 30 days)
I use matlab R2009b on windows 7 64-bit. I've been using it since 2009 with no troubles, now all the functions I defined in the past do not work anymore. To give an example:
I use often a function called "readdls9000" which is in C:\matlab folder
when I type
path
on prompt line the output is:
MATLABPATH
C:\matlab
C:\Users\cernicca\Documents\MATLAB
C:\Program Files\MATLAB\R2009b\toolbox\matlab\general
C:\Program Files\MATLAB\R2009b\toolbox\matlab\ops
C:\Program Files\MATLAB\R2009b\toolbox\matlab\lang
C:\Program Files\MATLAB\R2009b\toolbox\matlab\elmat
C:\Program Files\MATLAB\R2009b\toolbox\matlab\randfun
C:\Program Files\MATLAB\R2009b\toolbox\matlab\elfun
C:\Program Files\MATLAB\R2009b\toolbox\matlab\specfun
C:\Program Files\MATLAB\R2009b\toolbox\matlab\matfun
C:\Program Files\MATLAB\R2009b\toolbox\matlab\datafun
...
if I type
which readdls9000
the output is
C:\matlab\readdls9000.m % Has no license available
therefore the function is recognized by Matlab. However if I try to call it from prompt line or from a routine I get this:
>> readdls9000
??? Undefined function or variable 'readdls9000'.
This was just an example the same goes for any function that I wrote, which is in a folder added to Matlab path.

Accepted Answer

Thorsten
Thorsten on 6 Nov 2015
Edited: Thorsten on 6 Nov 2015
The hint is the string
% Has no license available
when you type which. This tells you that the file is there, put that the license to use it is missing. This can occur even for function that you wrote yourself, if there is a single function in the directory that has the same name as a function in a Matlab toolbox.
This issue occurs because one or more of the MATLAB files in this folder have the same name as a MATLAB function which is in a toolbox that you are not licensed for. This conflict occurs for certain specific functions. For example, suppose you have a MATLAB file called 'hamming.m' and do not have the Signal Processing Toolbox.
You will receive the same output for all MATLAB files located in the same folder as 'hamming.m' and will be unable to run any files in this directory. To work around the issue, rename the conflicting MATLAB file. In this case change the name of 'hamming.m'.
So probably you have recently added a function to your folder that has the same name as a function in a Matlab toolbox.
  1 Comment
Alessandro Cernicchi
Alessandro Cernicchi on 6 Nov 2015
Thank you Thorsten, that helped to workaround the problem.
Still I do not understand why everything worked OK up to some time ago and then this problems came about with no change made on my side. Why the hell can't I name functions with the same name as Matlab functions? How do I know if that function is in a toolbox if I don't have any toolbox.

Sign in to comment.

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!