Borrar filtros
Borrar filtros

sum of individual column values using logical operators

5 visualizaciones (últimos 30 días)
Usman Mussadiq
Usman Mussadiq el 23 de Mzo. de 2020
Comentada: Usman Mussadiq el 23 de Mzo. de 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
  2 comentarios
Usman Mussadiq
Usman Mussadiq el 23 de Mzo. de 2020
Thanks alot, your contribution means alot to me.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by