or operation on the columns of a matrix ?
17 次查看(过去 30 天)
显示 更早的评论
Hello!
I have matrix S that contains zeros and ones. and I want to convert it to a column vector contianing one in the ith position if there was at least one one in the ith row.
So I know that "or" operation does similar job but with two vectors. is there a way to use it with the columns of S ?
0 个评论
采纳的回答
Image Analyst
2019-5-12
Try
rowHasOnes = any(S, 2);
If not, then supply an example S and the expected result.
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!