how to convert a matrix given in range 5 to 1000 into matrix 0 to 255
1 次查看(过去 30 天)
显示 更早的评论
I have a matrix whose values lies in range from 5 to 1000. I want to convert it into he range of 0 to 255. please mention how to revert back to same range of 5 to 1000. please help
采纳的回答
Walter Roberson
2016-9-20
round( (Matrix - 5) / (1000-5) * 255 )
2 个评论
Walter Roberson
2016-9-21
Restored = double(Scaled_Matrix) * (1000-5)/255 + 5;
Note that you lose resolution when you do this: you will not be able to restore to exactly the same as the original.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!