how can i negative all rows in a matrix?just rows

1 visualización (últimos 30 días)
fariba amini
fariba amini el 7 de Mayo de 2016
Comentada: Jan el 7 de Mayo de 2016
how can i negative all rows in a matrix?just rows
  3 comentarios
John D'Errico
John D'Errico el 7 de Mayo de 2016
One can only presume that the OP is asking how to negate an array. But then why would that negate only the rows, and not the columns?
Jan
Jan el 7 de Mayo de 2016
@fariba amini: Please post a small example which explains, what "negative rows" means and how if differs from negate the elements.

Iniciar sesión para comentar.

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 7 de Mayo de 2016
Let a - your array
a = [-4 0 1 -2 -3
-3 -5 -5 -2 -1
3 2 -3 1 0
-1 3 -5 2 -4
2 1 -5 -4 -4
-4 -1 -2 -1 -1
-2 1 1 -1 3
3 -2 -3 0 -2
2 0 3 1 0
3 -4 -5 1 -3];
out = a(all(sign(a) == -1,2),:);
  1 comentario
Jan
Jan el 7 de Mayo de 2016
This is finding all rows, which contain negative values only.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by