Represent array in percentage
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nithesh Thakku Krishnamoorthy Ganesan
am 14 Jun. 2021
Kommentiert: Nithesh Thakku Krishnamoorthy Ganesan
am 14 Jun. 2021
I have an array, I want to display the array in percentage such that the maximum value in the array is displayed as 100% and the minimum value as 0%. How do i this?
My array is [2.5 2.6 ........ 4.2]
I want to it to be displayed where 2.5 becomes 0% and 4.2 becomes 100%
0 Kommentare
Akzeptierte Antwort
Joseph Cheng
am 14 Jun. 2021
Bearbeitet: Joseph Cheng
am 14 Jun. 2021
you would take your array, subtract the minimum, then divide by the resulting maximum x 100
x = [2.4:.4:4.2];
x = x-min(x);
disp(x)
percX = x./(max(x(:)))*100
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!