Filter löschen
Filter löschen

sum of individual column values using logical operators

5 Ansichten (letzte 30 Tage)
Usman Mussadiq
Usman Mussadiq am 23 Mär. 2020
Kommentiert: Usman Mussadiq am 23 Mär. 2020
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

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by