Count how many numbers are above -1 in matrix

1 回表示 (過去 30 日間)
Jung
Jung 2019 年 11 月 14 日
編集済み: ME 2019 年 11 月 14 日
Hello,
I have a large matrix which contains NSE value. I'd like to count how many cells there are with NSE values are above -1 and their location as well.
For instance if x = [0.1 -2 -3 0.3 -0.1 -84], there are 3 NSE values that are above -1 (0.1 0.3 and -0.1) and their locations are 1 4 5
Any help would be appreciated,

回答 (1 件)

ME
ME 2019 年 11 月 14 日
編集済み: ME 2019 年 11 月 14 日
To find the locations of your values you can use
idx = find(x>-1);
And to get the values you can use
val = x(idx);

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by