What is the difference between rand and randi when using it in a 3D array
Afficher commentaires plus anciens
What is the difference between rand and randi when using it in a 3D array
Réponse acceptée
Plus de réponses (1)
madhan ravi
le 25 Août 2018
Maybe try this:
array(randi([1 length(array)],1))
8 commentaires
madhan ravi
le 25 Août 2018
Modifié(e) : madhan ravi
le 25 Août 2018
Doesn’t it work? You changed the question?
Shivam
le 25 Août 2018
madhan ravi
le 25 Août 2018
randi produces random integer numbers and rand produces random floating numbers
madhan ravi
le 25 Août 2018
randi was used here because the index of an array should be an integer.
madhan ravi
le 25 Août 2018
Was my answer different?
Shivam
le 25 Août 2018
madhan ravi
le 25 Août 2018
Give a vote for my answer if you find it useful :)
Foad Brakhasi
le 18 Jan 2023
Thanks it was useful.
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!