Sorting of vector values

I have two vectors A and B obtained after MATLAB analysis. Both matrices have positive and negative values, starting from the same index. I want to replace all the negative values from let's say vector A with the corresponding positive values from vector B and vice-versa. How do I do that ?

3 comentarios

Paolo
Paolo el 12 de Jul. de 2018
What happens when both A and B are negative at the same index?
Guillaume
Guillaume el 12 de Jul. de 2018
And what happens if both are positive for that matter?
Why not take the maximum of both:
C = max(A, B);
dpb
dpb el 12 de Jul. de 2018
Editada: dpb el 12 de Jul. de 2018
"... what happens if both are positive...?"
As OP wrote the problem description, nothing happens to A as it's nonnegative.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Etiquetas

Preguntada:

el 12 de Jul. de 2018

Editada:

dpb
el 12 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by