필터 지우기
필터 지우기

sum of individual column values using logical operators

조회 수: 5 (최근 30일)
Usman Mussadiq
Usman Mussadiq 2020년 3월 23일
댓글: Usman Mussadiq 2020년 3월 23일
x=[2 1 ;-1 1 ;-1 2 ;1 -1 ;5 -1 ]
ind = x(:,2)<0
C = abs(sum(x(ind)))
ind = x(:,2)>0
D= abs(sum(x(ind)))
here, i need only sum of all rows and second column logical values, while it gives the whole if i remove (:,2) and answer will be not appropriate when i add this one. please guide me
  댓글 수: 2
Usman Mussadiq
Usman Mussadiq 2020년 3월 23일
Thanks alot, your contribution means alot to me.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by