By what I can replace randint() function.

Here is a randint function, i am not having communication toolbox. How i can rewrite this statement. k = randint(1,1,10)+5;

 Akzeptierte Antwort

Torsten
Torsten am 20 Sep. 2018
Bearbeitet: Torsten am 20 Sep. 2018

0 Stimmen

r = rand(1,1);
k = min(floor(10*r),9)+5

Weitere Antworten (1)

Steven Lord
Steven Lord am 20 Sep. 2018

0 Stimmen

The recommendation in the Release Notes is to use randi instead. The equivalent call is:
randi([5, 14], [1 1])
since randint(1, 1, 10) created a number in the range [0, 9].

Kategorien

Mehr zu Simscape Electrical finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 20 Sep. 2018

Beantwortet:

am 20 Sep. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by