Boolean Vector Length Calculation
显示 更早的评论
Hi all,
I have a vector consisting of booleans, either 1 or 0. Such as {0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0}. 1 values by itself cannot be in between of 0s. The same rule is valid also for 0s. I need the length of 1s separately. In other words, I do not want to know the length of all 1s. Instead, what I look for is the length of each 1s accumulated inside the vector independently. How can I find the length of 1s via matlab?
Thank you in advence.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Language Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!