フィルターのクリア

finding NON in matrix

1 回表示 (過去 30 日間)
rahman
rahman 2011 年 5 月 24 日
Hi all In the matrix A which is 1*N matrix, I want to recognize if there is any element equal to NON in it,I replace it by zero.How can I do that?
  2 件のコメント
Sean de Wolski
Sean de Wolski 2011 年 5 月 24 日
Do you mean NaN?
rahman
rahman 2011 年 5 月 24 日
Oops!!
that a really big mistake!
yes, NON means NaN ;)

サインインしてコメントする。

採用された回答

Laura Proctor
Laura Proctor 2011 年 5 月 24 日
I'm going to assume that you mean NaN. You can use the ISNAN function to find and replace the NaNs in your code. Here's an example:
A = randn(1,100);
A([2,10,23,47,88]) = NaN;
A(isnan(A)) = 0;
  1 件のコメント
rahman
rahman 2011 年 5 月 24 日
tnx lot

サインインしてコメントする。

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2011 年 5 月 24 日
A(isnan(A)) = 0;
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 5 月 24 日
You're fast today, Sean!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by