rng('default') error message

4 vues (au cours des 30 derniers jours)
Ilja
Ilja le 27 Nov 2019
Commenté : Ilja le 3 Déc 2019
Hi,
I'm using a Matlab program for which Matlab 2018a was required. I have the following:
MATLAB Version: 9.5.0.944444 (R2018b)
MATLAB License Number: XXXXXXXXXX
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 16299)
Java Version: Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.5 (R2018b)
Brick, also called "fn toolbox" is a set of use... Version 1.1
Image Processing Toolbox Version 10.3 (R2018b)
Parallel Computing Toolbox Version 6.13 (R2018b)
Signal Processing Toolbox Version 8.1 (R2018b)
Statistics and Machine Learning Toolbox Version 11.4 (R2018b)
Wavelet Toolbox Version 5.1 (R2018b)
In this program the function rng.m is called upon several times but each time the following error message occurs:
Error using rand
State must be a double scalar or the output of RAND('twister').
Error in rng (line 18)
rand('twister',seed.rand);
Error in make_eMouseData (line 20)
rng('default');
Error in master_eMouse (line 26)
make_eMouseData(fpath, useGPU);
Simply running rng('default') spits out the following:
Error using rand
State must be a double scalar or the output of RAND('twister').
Error in rng (line 18)
rand('twister',seed.rand);
Thus, independent of whether I run the program or simpy the error causing function it leads to the same error message. I was wondering what I could do to fix this problem? Any advice would be greatly appreciated.
Thanks,
Ilja

Réponse acceptée

Walter Roberson
Walter Roberson le 28 Nov 2019
Error in rng (line 18)
rand('twister',seed.rand);
Notice the line number of rng there: line 18. The real Mathworks rng.m has over 50 lines of comments at the beginning of it.
What is happening is that you have a different rng.m on your MATLAB path that is taking priority over the MATLAB rng.m
which -all rng
You should typically only see one result that is under toolbox/matlab/randfun/rng.m . I am fairly sure you will see two results instead and that the first one is not in a MATLAB installation directory. You will need to track that down and rename it or delete it.
  1 commentaire
Ilja
Ilja le 3 Déc 2019
Thanks, very much. Once I deleted the path to the wrong rng.m file it worked just fine.
Thanks again.
Ilja

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by