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;

 採用された回答

Torsten
Torsten 2018 年 9 月 20 日
編集済み: Torsten 2018 年 9 月 20 日

0 投票

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2018 年 9 月 20 日

0 投票

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].

カテゴリ

ヘルプ センター および File ExchangeSimscape Electrical についてさらに検索

質問済み:

2018 年 9 月 20 日

回答済み:

2018 年 9 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by