Issue: Unable to resolve the name coder.internal.rnd

30 visualizaciones (últimos 30 días)
Patrick Laux
Patrick Laux el 8 de Jun. de 2020
Comentada: Patrick Laux el 9 de Jun. de 2020
Dear all,
I am runnunig matlab 2019b on a linux cluster.
I am getting the following issue after launching matlab (with matlab -nodisplay) and running a simple function. I guess this is something related to the path, and I also could not get the first warning, since there is no file called randg in the start path.
Any help appreciated.
Patrick
< M A T L A B (R) >
Copyright 1984-2019 The MathWorks, Inc.
R2019b (9.7.0.1190202) 64-bit (glnxa64)
August 21, 2019
Warning: Function randg has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.
To get started, type doc.
For product information, visit www.mathworks.com.
>>
>> y = exprnd(10,50,1);
Unable to resolve the name coder.internal.rnd.
Error in exprnd (line 10)
r = coder.internal.rnd('exprnd',mu,varargin{:});
  3 comentarios
Patrick Laux
Patrick Laux el 8 de Jun. de 2020
Thanks a lot,
this avoids the errors from before, but now, it cannot find the function exprnd anymore. I store the pathdef.m in the folder from which I usually launch matlab (savepath('.../MATWORK/pathdef.m'))
>> y = exprnd(10,50,1);
Unrecognized function or variable 'exprnd'.
Adding the path of the eml toolbox, again leads to
>> addpath('/app/matlab/2019b/toolbox/stats/eml/')
>> y = exprnd(10,50,1);
Unable to resolve the name coder.internal.rnd.
Error in exprnd (line 10)
r = coder.internal.rnd('exprnd',mu,varargin{:});
Walter Roberson
Walter Roberson el 8 de Jun. de 2020
you need the Statistics And Machine Learning Toolbox.
You should not add the path you added: it is only for use in MATLAB Coder.

Iniciar sesión para comentar.

Respuestas (2)

Patrick Laux
Patrick Laux el 9 de Jun. de 2020
Dear Walter,
thanks to your suggestion. You are right, of course.
However, it seems that the issue still persists. To check out the reason, I applied a simple example now locally on my machine and repeated the same remotely on the cluster.
The example is to calculate the ecdf of a vector:
B=rand(1000,1);
[f, y1] = ecdf(B);
It works locally, but not on the cluster:
>> [f, y1] = ecdf(B);
Unable to resolve the name statslib.internal.parseArgs.
Error in internal.stats.parseArgs (line 42)
[varargout{1:nargout}] = statslib.internal.parseArgs(pnames,dflts,varargin{:});
Error in ecdf (line 91)
[cens,freq,alpha,fn,bounds] = internal.stats.parseArgs(okargs, defaults, varargin{:});
Interestingly, if I do not add a path:
>> which ecdf
/app/matlab/2019b/toolbox/stats/eml/ecdf.m
In turn, if I add the Statistics And Machine Learning Toolbox manually:
>> addpath(genpath('/app/matlab/2019b/toolbox/stats/stats'))
>> which ecdf
/app/matlab/2019b/toolbox/stats/stats/ecdf.m
but also:
>> [f, y1] = ecdf(B);
Unable to resolve the name statslib.internal.parseArgs.
Error in internal.stats.parseArgs (line 42)
[varargout{1:nargout}] = statslib.internal.parseArgs(pnames,dflts,varargin{:});
Error in ecdf (line 91)
[cens,freq,alpha,fn,bounds] = internal.stats.parseArgs(okargs, defaults, varargin{:});
On my local machine, I have matlab 2018b and the ecdf function is located in
/Applications/MATLAB_R2018b.app/toolbox/stats/stats/ecdf.m
and is working properly:
>> [f, y1] = ecdf(B)
f =
0
0.0010
0.0020
0.0030
0.0040
...
Is there any way to figure out what is going on there? I highly appreciate your help.
Patrick
  1 comentario
Patrick Laux
Patrick Laux el 9 de Jun. de 2020
seems that the issue is solved. There was a problem with the installation ... After reinstallation, it worked.

Iniciar sesión para comentar.


Steven Lord
Steven Lord el 9 de Jun. de 2020
You should not try to add directories in MathWorks products under matlabroot to the path. If they're supposed to be on the path, they should be added to the path automatically by the installer and/or Add-On Manager when the toolbox is installed.
If the path gets corrupted to the point where MATLAB isn't working, restoredefaultpath then add the directories containing your files to the path.
The files in that eml subdirectory, I believe, are intended only to be used by MATLAB Coder when generating code from Statistics and Machine Learning Toolbox function. But by adding that directory to the path, you make them available to everyone.
  1 comentario
Patrick Laux
Patrick Laux el 9 de Jun. de 2020
Yes, Steven, you are fully right.
Since the installer did not add the path correctly (due to problems possibly during installation process) restoredefaultpath did not help also. At the end, only re-installation was successfully.
After reinstallation, paths were correctly set.
Do not add toolbox directories under matlabroot to the path manually should be the main message.

Iniciar sesión para comentar.

Categorías

Más información sobre Naming Conventions 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