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.
2 次查看(过去 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 个)
另请参阅
类别
在 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!