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일
Thanks! That's the expression I was searching for! :-)
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에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by