How to find a maximum number not considered minus sign?
35 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jothi
am 17 Jul. 2014
Kommentiert: Bruno Luong
am 28 Mär. 2021
Sir,
I want find the maximum number in the given array.
But, I am not considered negative sign.
for example, a=[4, 3, -8],
output is = -8. Because 8 is the maximum number.
how I get this output.
thank you.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Matz Johansson Bergström
am 17 Jul. 2014
It sounds like you want to find the max absolute value of a vector. This can be accomplished simply by taking the absolute value and remember the index to that value and picking it out:
a = [1,4,5,-8,3];
[val, ind] = max(abs(a));
a(ind)
2 Kommentare
Siehe auch
Kategorien
Mehr zu Wavelet Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!