Creating vectors by rand() and looping it
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!