フィルターのクリア

How to replace any value into vector or matrix to -inf

1 回表示 (過去 30 日間)
Triveni
Triveni 2016 年 7 月 12 日
コメント済み: Walter Roberson 2016 年 7 月 12 日
ab =
11.0000
11.5000
12.0000
12.1000
12.2000
12.3000
11.2000
9.0000
9.5000
11.3000
ab<10
ans =
Columns 1 through 9
0 0 0 0 0 0 0 1 1
Column 10
0
ab1
ab1 =
Columns 1 through 5
11.0000 11.5000 12.0000 12.1000 12.2000
11.1000 11.4000 12.0000 12.1000 12.2000
Columns 6 through 10
12.3000 11.2000 9.0000 9.5000 11.3000
12.3000 11.2000 9.0000 9.5000 11.3000
>> ab1<10
ans =
Columns 1 through 9
0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 1 1
Column 10
0
0
i want to replace ab<10 to -inf, without loop, and other variables and matrix size remains same. It should be applicable to any type of matrix.

採用された回答

Walter Roberson
Walter Roberson 2016 年 7 月 12 日
ab(ab<10) = -inf;
  2 件のコメント
Triveni
Triveni 2016 年 7 月 12 日
編集済み: Walter Roberson 2016 年 7 月 12 日
Sir, If i need to be make other matrix's index -inf then how can i do?.
f_data =
1.0000
13.5000
11.0000
12.1000
12.2000
13.3000
11.2000
13.0000
13.5000
8.3000
In both matrices any index<10, i have to make both corresponding matrix -inf.
Walter Roberson
Walter Roberson 2016 年 7 月 12 日
mask = ab<10 | f_data<10;
a(mask) = -inf;
f_data(mask) = -inf;

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

その他の回答 (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