find largest magnitude in array

A=[-0.1;1;-5;-0.8;-0.4];
tto=find(A == max(abs(A)))
tt=find(A ~= max(abs(A)))
I want to find index of largest magnitude in array and put it in 'tto'.
And put rest indices in tt
result should be
tto=3
tt=[1;2;4;5]

 採用された回答

gonzalo Mier
gonzalo Mier 2019 年 5 月 9 日
編集済み: gonzalo Mier 2019 年 5 月 9 日

0 投票

A=[-0.1;1;-5;-0.8;-0.4];
tto=find(abs(A) == max(abs(A)))
tt=find(abs(A) ~= max(abs(A)))

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Mobile についてさらに検索

質問済み:

NA
2019 年 5 月 9 日

編集済み:

2019 年 5 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by