Represent array in percentage
16 次查看(过去 30 天)
显示 更早的评论
Nithesh Thakku Krishnamoorthy Ganesan
2021-6-14
评论: Nithesh Thakku Krishnamoorthy Ganesan
2021-6-14
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 个评论
采纳的回答
Joseph Cheng
2021-6-14
编辑:Joseph Cheng
2021-6-14
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!