Indexing through an array
3 次查看(过去 30 天)
显示 更早的评论
Suppose I have this
B = [1 4 7 10; 2 5 8 11;3 6 9 12]
1 4 7 10
2 5 8 11
3 6 9 12
And I want to check through each column for a value of 2. How would I do this?
1 个评论
James Tursa
2021-3-3
What do you want as a result? A logical array indicating which columns have a 2 in them? An outline for a for-loop that checks for a 2 in a column? Or ...?
回答(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!