-
3 Comments
Qinghua Ye
on 16 May 2019
function y = lengthOnes(x)
a = [];
idx = [1,find(x=='0') + 1,length(x)+2];
le = length(idx);
a(1:le-1) = idx(2:le)-idx(1:le-1)-1;
y = max(a);
end
Sanzhar Askaruly
on 17 Jun 2019
no regexp is needed actually
Adnan Anjum
on 29 Jan 2020
Cool
Suggested Problems
-
9015 Solvers
-
Return a list sorted by number of occurrences
2833 Solvers
-
1033 Solvers
-
Set some matrix elements to zero
575 Solvers
-
Relative ratio of "1" in binary number
1503 Solvers
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!