フィルターのクリア

How can I filter the negative value?

3 ビュー (過去 30 日間)
sewook
sewook 2012 年 4 月 20 日
Hello, I am a beginner at MATLAB and English, but I would like to use this tool, please give a answer.
the matrix A like below:
A = [100 -20 50 -3]
I would like to convert like below:
B = [100 0 50 0] %make 0 if a value is negative.
or
C = [10000 -20 5000 -3] % multiply 100 if value is positive.
how can I do this convertion?

採用された回答

Rick Rosson
Rick Rosson 2012 年 4 月 20 日
B = A.*(A>0);
C = A.*(A>0)*100 + A.*(A<0);
  1 件のコメント
sewook
sewook 2012 年 4 月 20 日
Thank you~ ^^;
it is very simple and clear~~

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by