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!