MATLAB: How to convert a matrix given in range 5 to 1000 into matrix 0 to 255

image processing

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

Best Answer

round( (Matrix - 5) / (1000-5) * 255 )