MATLAB: How to adjust the numbers

adjusting numberssetting boundries

Hello,
Lets say I have random 64.000 numbers. Min = -36.000 and Max is = 40.000, I want to make the minimum number equals to 0 and maximum number 255 and the rest of numbers has to be adjust accordingly. Is there any way that I can do such thing ?
Thank you,

Best Answer

out = (yourarray - min1)/(max1-min1)*255