Borrar filtros
Borrar filtros

How can I select only the values in a Matrix, which don't have the value?

1 visualización (últimos 30 días)
I search for an expression for that, because I can't divide by 0 and for later use I need Matrixelements which don't have the value 0. Would be glad, if someone could help me.
Matrix1Quotient = MatrixB ./ MatrixA;
This says that the matrixelements must not be 0. But don't select the elements which are ~=0:
Mat1Quot(:,:)~=0

Respuesta aceptada

Pedro Villena
Pedro Villena el 19 de Oct. de 2012
i=find(~MatrixA);
Matrix1Quotient = MatrixB(i)./MatrixA(i);
  2 comentarios
Simon
Simon el 19 de Oct. de 2012
Thanks! That's the expression I was searching for! :-)
Simon
Simon el 19 de Oct. de 2012
Ah, as a result I get a skalar. Unfortunately I need a Matrix. Does there any find-expression exist, which gives out a matrix?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical 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