フィルターのクリア

Index nearest vlaue to zero between some negative and posetive values in one row

2 ビュー (過去 30 日間)
BN
BN 2020 年 4 月 11 日
コメント済み: BN 2020 年 4 月 11 日
Hello, I have a table, I want to index the nearest value to the zero in each row; I have some data like -0.009, 0.0025 ( I mean negative and positive).
If I want to index nearest rows to 1 I know I can use this:
[~,i] = min(1-[TEST.model1_CC, TEST.model2_CC, TEST.model3_CC],[],2);
But I have'nt Idea how to index nearest value to the zero.

採用された回答

Walter Roberson
Walter Roberson 2020 年 4 月 11 日
[~,i] = min(abs([TEST.model1_CC, TEST.model2_CC, TEST.model3_CC]),[],2);

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by