Error when using 'Run Section'

I get the following error whenever I click on Run section.
If i run the entire script the it works fine.
If i select individual snipets of code then it still works fine. Only run section produces this error. The same error no matter hat code i am runnng.
I have windows 10 and MATLAB 2020a.
P.S. I have 2020a installed on my other computers and they work just fine.
the problem is only on this computer. I installed MATLAB two weeks ago and the probem is since the starting.
Error using randi
Invalid default value for property 'Salt' in class 'matlab.internal.editor.eval.TempFolder':
Too many input arguments.
Error in matlab.internal.editor.eval.FileInfo
Error in matlab.internal.editor.eval.TmpFilePath.get
Error in matlab.internal.editor.evaluateCode
Error in matlab.internal.editor.evaluateCode

2 个评论

What does which('randi','-all') return?
It returns the following:
>> which('randi','-all')
C:\Users\maris\Desktop\Bachelor Thesis\mvgc_v1.0\mvgc_v1.0\utils\legacy\randi\randi.m
C:\Program Files\MATLAB\R2020a\toolbox\matlab\randfun\@RandStream\randi.m % RandStream method
C:\Program Files\MATLAB\R2020a\toolbox\parallel\parallel\@codistributed\randi.m % codistributed method
C:\Program Files\MATLAB\R2020a\toolbox\parallel\parallel\@codistributor1d\randi.m % codistributor1d method
C:\Program Files\MATLAB\R2020a\toolbox\parallel\parallel\@codistributor2dbc\randi.m % codistributor2dbc method
C:\Program Files\MATLAB\R2020a\toolbox\parallel\parallel\@distributed\randi.m % distributed method
C:\Program Files\MATLAB\R2020a\toolbox\parallel\gpu\@gpuArray\randi.m % gpuArray method
built-in (C:\Program Files\MATLAB\R2020a\toolbox\matlab\randfun\randi) % Shadowed

请先登录,再进行评论。

 采纳的回答

Rik
Rik 2020-8-25
编辑:Rik 2020-8-25
Remove the randi function here from your path:
C:\Users\maris\Desktop\Bachelor Thesis\mvgc_v1.0\mvgc_v1.0\utils\legacy\randi\randi.m
Either rename the file, delete it, or remove the folder from your path.
For an explanation of why it is a bad habit to shadow the names of internal functions, see this thread. As you see, stuff tends to break at some point.

2 个评论

I just removed the function from the path and this happened:
Error using matlab.internal.editor.eval.FileInfo
Invalid default value for property 'Salt' in class 'matlab.internal.editor.eval.TempFolder':
Previously accessible file "C:\Users\maris\Desktop\Bachelor Thesis\mvgc_v1.0\mvgc_v1.0\utils\legacy\randi\randi.m" is now inaccessible.
Error in matlab.internal.editor.eval.TmpFilePath.get
Error in matlab.internal.editor.evaluateCode
Error in matlab.internal.editor.evaluateCode
Sorry i closed and restarted the MATLAB program it is working now ;)
Thanks alot!!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品

版本

R2020a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by