I need to iterate through a vector, A, using a for loop, and create a new vector, B, containing logical values. The new vector should contain true for odd values and false for all other values.
조회 수: 1 (최근 30일)
이전 댓글 표시
I have to use either for or while to solve this problem and I have been working on it for about a while now and cant seem to figure it out. I am given an example though: A=[-300 2 5 -63 4 0 -46], the result should be B=[false false true true false false fasle]
답변 (1개)
Image Analyst
2018년 9월 28일
Hint: look up mod() or rem() in the help. Look up "for" in the help.
댓글 수: 0
참고 항목
카테고리
Help Center 및 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!