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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 20 Nov 2013
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)

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by