Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem with random function

Subject: problem with random function

From: Alessandro

Date: 7 Nov, 2012 18:20:12

Message: 1 of 4

Hi all,
I have a big problem because few days ago it was all working well and now nothing...

I cant' use this function in MATLAB, neither from the command line: http://www.mathworks.it/it/help/stats/random.html

if I try to do this: random('Uniform',0,1)
it returns:
"Error using rand
Seed must be a double scalar.
Error in random.seed (line 39)
            rand('seed',uiseed); % Initialize seed
Error in random (line 24)
                random.seed(iseed);"

I've used the random function because was more clear in the code, but now doesn't go anymore...
Can anyone help me? Have I to reinstall MATLAB?

Subject: problem with random function

From: Steven_Lord

Date: 7 Nov, 2012 18:45:13

Message: 2 of 4



"Alessandro " <dehno.admin@gmail.com> wrote in message
news:k7e8os$j6h$1@newscl01ah.mathworks.com...
> Hi all,
> I have a big problem because few days ago it was all working well and now
> nothing...
>
> I cant' use this function in MATLAB, neither from the command line:
> http://www.mathworks.it/it/help/stats/random.html
>
> if I try to do this: random('Uniform',0,1)
> it returns:
> "Error using rand
> Seed must be a double scalar.
> Error in random.seed (line 39)

This makes me suspect that you have a class on your path named random that
is shadowing the Statistics Toolbox function. Execute this command to test
this hypothesis:

which -all random

If the first line is NOT the random.m from Statistics Toolbox, rename or
delete the random class, remove the directory containing it from the MATLAB
path, or move it lower on the path than Statistics Toolbox.

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: problem with random function

From: Alessandro

Date: 7 Nov, 2012 19:15:11

Message: 3 of 4

"Steven_Lord" <slord@mathworks.com> wrote in message <k7ea7o$p8k$1@newscl01ah.mathworks.com>...
>
>
> "Alessandro " <dehno.admin@gmail.com> wrote in message
> news:k7e8os$j6h$1@newscl01ah.mathworks.com...
> > Hi all,
> > I have a big problem because few days ago it was all working well and now
> > nothing...
> >
> > I cant' use this function in MATLAB, neither from the command line:
> > http://www.mathworks.it/it/help/stats/random.html
> >
> > if I try to do this: random('Uniform',0,1)
> > it returns:
> > "Error using rand
> > Seed must be a double scalar.
> > Error in random.seed (line 39)
>
> This makes me suspect that you have a class on your path named random that
> is shadowing the Statistics Toolbox function. Execute this command to test
> this hypothesis:
>
> which -all random
>
> If the first line is NOT the random.m from Statistics Toolbox, rename or
> delete the random class, remove the directory containing it from the MATLAB
> path, or move it lower on the path than Statistics Toolbox.
>
> *snip*
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

You're the best! I was going crazy!
It was just a path added yesterday for another project which included a file random.m
Thanks a lot!

Subject: problem with random function

From: Peter Perkins

Date: 7 Nov, 2012 19:15:21

Message: 4 of 4

You should get rid of the class (?) because it appears to be using a
very old random number generator syntax ("rand('seed',s)") that causes
MATLAB to use a very outdated random number generator.


On 11/7/2012 1:45 PM, Steven_Lord wrote:
>
>
> "Alessandro " <dehno.admin@gmail.com> wrote in message
> news:k7e8os$j6h$1@newscl01ah.mathworks.com...
>> Hi all,
>> I have a big problem because few days ago it was all working well and
>> now nothing...
>>
>> I cant' use this function in MATLAB, neither from the command line:
>> http://www.mathworks.it/it/help/stats/random.html
>>
>> if I try to do this: random('Uniform',0,1)
>> it returns:
>> "Error using rand
>> Seed must be a double scalar.
>> Error in random.seed (line 39)
>
> This makes me suspect that you have a class on your path named random
> that is shadowing the Statistics Toolbox function. Execute this command
> to test this hypothesis:
>
> which -all random
>
> If the first line is NOT the random.m from Statistics Toolbox, rename or
> delete the random class, remove the directory containing it from the
> MATLAB path, or move it lower on the path than Statistics Toolbox.
>
> *snip*
>

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us