generating random numbers only 2 numbers

8 vues (au cours des 30 derniers jours)
Takim Mustakim
Takim Mustakim le 17 Sep 2021
Commenté : Chunru le 17 Sep 2021
i want to generating random numbers on matrix 1x30
how i get generating 2 random numbers (only 1 and 4 , not between) ???

Réponse acceptée

Chunru
Chunru le 17 Sep 2021
Modifié(e) : Chunru le 17 Sep 2021
a = randi([0 1], [1 30])*3 + 1
a = 1×30
1 1 4 4 4 4 4 1 1 4 1 4 4 4 1 4 4 4 1 1 1 4 1 4 4 1 4 4 4 4
  2 commentaires
Takim Mustakim
Takim Mustakim le 17 Sep 2021
ohhhh thank you bro/sist
Chunru
Chunru le 17 Sep 2021
Consider to accept the answer.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Random Number Generation dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by