MATLAB Answers

find largest magnitude in array

11 views (last 30 days)
Na
Na on 9 May 2019
Edited: gonzalo Mier on 9 May 2019
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]

  0 Comments

Sign in to comment.

Accepted Answer

gonzalo Mier
gonzalo Mier on 9 May 2019
Edited: gonzalo Mier on 9 May 2019
A=[-0.1;1;-5;-0.8;-0.4];
tto=find(abs(A) == max(abs(A)))
tt=find(abs(A) ~= max(abs(A)))

  0 Comments

Sign in to comment.

More Answers (0)