-
2 Comments
Haoyu Dai
on 30 Apr 2020
function y = lengthOnes(x)
cnt=0;
a=[];
L=strlength(x);
for i=1:L
if x(i)=='1'
cnt=cnt+1;
else
cnt=0;
end
a(i)=cnt;
end
[y,index]=max(a);
end
Syed Shahed
on 3 May 2020
Excellent work man :)
Suggested Problems
-
Find the numeric mean of the prime numbers in a matrix.
9023 Solvers
-
Return unique values without sorting
947 Solvers
-
1928 Solvers
-
885 Solvers
-
7698 Solvers
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!