-
1 Comment
Muhammad Zikril Hakim bin Zulkifly
on 29 Feb 2024
function y = one(x)
a=num2str(x)
y=0;
for i=1:length(a)
if a(i)=='1';
y=y+1;
end
end
end
Suggested Problems
-
2400 Solvers
-
1327 Solvers
-
Getting the indices from a vector
10817 Solvers
-
582 Solvers
-
5818 Solvers
More from this Author1
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!