필터 지우기
필터 지우기

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

조회 수: 1 (최근 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)
  댓글 수: 2
Image Analyst
Image Analyst 2013년 11월 20일
or sum(v==1) just in case there are any integers other than 0 and 1 in there.
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013년 11월 20일
Thanks image analyst and azzi...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by