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

3 次查看(过去 30 天)
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

采纳的回答

Pedro Villena
Pedro Villena 2012-10-19
i=find(~MatrixA);
Matrix1Quotient = MatrixB(i)./MatrixA(i);
  2 个评论
Simon
Simon 2012-10-19
Ah, as a result I get a skalar. Unfortunately I need a Matrix. Does there any find-expression exist, which gives out a matrix?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by