How map values of array to 0 and 1
41 次查看(过去 30 天)
显示 更早的评论
How can i write a function such that it takes an array, and outputs an array of same size with values lying in [0,1] but also that the largest value is mapped to 1, and smallest to 0?
0 个评论
回答(2 个)
Guillaume
2019-12-6
It's trivial normalisation. Subtract the minimum of your array so the new minimum is 0, then divide by the max of that new array so the max becomes 1.
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!