フィルターのクリア

about rand and randi command

1 回表示 (過去 30 日間)
Oguzhan Sanliturk
Oguzhan Sanliturk 2020 年 3 月 15 日
コメント済み: Oguzhan Sanliturk 2020 年 3 月 15 日
hi, i was wondering about how can i include number '0' in a randi command.
when i use it like 'randi(10)' it is always giving me numbers 1 to 10 but i need '0' also.
HELP please :D

採用された回答

Sriram Tadavarty
Sriram Tadavarty 2020 年 3 月 15 日
Hi Oguzhan,
For the sample code, you can use this function signature
a = randi([0 10],1,1); % it will generate a random integer number from 0 (lower limit) to 10 (upper limit) of size 1 x 1
Here is the documentation link of randi, which provides more examples. https://www.mathworks.com/help/matlab/ref/randi.html
Hope this solves your issue.
Regards,
Sriram
  1 件のコメント
Oguzhan Sanliturk
Oguzhan Sanliturk 2020 年 3 月 15 日
Totally understood! Thanks for your time Sriram!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by