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

3 ビュー (過去 30 日間)
Simon
Simon 2012 年 10 月 19 日
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 Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by