how to find the total number of ones from the given input...

2 次查看(过去 30 天)
suppose my input is a=1,b=1,c=1,d=0... my objective is to find count the total number of ones.. how to find.. which method is good to follow

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-11-20
a=1,
b=1,
c=1,
d=0
Instead of using all these variables, you can use just one array
v=[a b c d ]
To count number of ones
no=sum(v)

更多回答(0 个)

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by