What is the difference between rand and randi when using it in a 3D array
Mostrar comentarios más antiguos
What is the difference between rand and randi when using it in a 3D array
Respuesta aceptada
Más respuestas (1)
madhan ravi
el 25 de Ag. de 2018
Maybe try this:
array(randi([1 length(array)],1))
8 comentarios
madhan ravi
el 25 de Ag. de 2018
Editada: madhan ravi
el 25 de Ag. de 2018
Doesn’t it work? You changed the question?
Shivam
el 25 de Ag. de 2018
madhan ravi
el 25 de Ag. de 2018
randi produces random integer numbers and rand produces random floating numbers
madhan ravi
el 25 de Ag. de 2018
randi was used here because the index of an array should be an integer.
madhan ravi
el 25 de Ag. de 2018
Was my answer different?
Shivam
el 25 de Ag. de 2018
madhan ravi
el 25 de Ag. de 2018
Give a vote for my answer if you find it useful :)
Foad Brakhasi
el 18 de En. de 2023
Thanks it was useful.
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!