Creating vectors by rand() and looping it
Mostrar comentarios más antiguos
The question: Create a vector A with 10 integer numbers by rand(), and ceil() or floor() or round. Each number is between 5 and 20. Then iterate through the vector and return a new vector B, containing the true wherever an element of A is greater than 12, and false otherwise.
Use loop(for loop or while loop). Do not use vector operations. Please display both A and B.
I started off creating
a=5
b=20
vector=(b-a)*rand(10,1)+a
ceil(vector)
for the first part with 10 integer between 5-20. I'm little lost in what to do with the next steps, esp the loop.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements 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!